0

I have a Dashboard with diffrent tiles. In my last tile, I included a OxyPlot-Chart as a UserControl. But it's the only UserControl that won't stretch. It renders with Height = 0. I just get the result by setting the height to a fix size - Auto also does not affect anything. Also remove the "d" size of the UserControl.

xaml:

<StackPanel Grid.Column="2" Grid.Row="2" Background="{StaticResource TileBackground}" Margin="10">
   <DockPanel LastChildFill="False" VerticalAlignment="Top" HorizontalAlignment="Stretch" Background="#FF1E7DBF" Margin="0,0,0,5">
      <TextBlock DockPanel.Dock="Top" Text="24H-PERFORMANCE" Margin="30,10,30,10"
                           TextAlignment="Center" FontFamily="Segoe UI SemiBold" Foreground="White" FontSize="26" />
   </DockPanel>
   <local:DayPerformance />
</StackPanel>

userControl:

<Grid>
   <oxy:PlotView x:Name="performanceMonitor" Model="{Binding performancePlot}" Background="Transparent"/>
</Grid>
caner
  • 721
  • 5
  • 21
a.w.
  • 261
  • 2
  • 16
  • As a quick answer `StackPanel` will autosize itself to content. You have (must?) to use another container, e.g. `Grid` with row definitions to be able to stretch content. Not sure which duplicate address this issue the best, but [here](http://stackoverflow.com/q/3737077/1997232) is one. – Sinatr May 15 '17 at 13:48
  • Ok I will try. In my other tiles I also use StackPanel and loading UserControls - here it works fine. – a.w. May 15 '17 at 13:49
  • No it can't be true. Vertical `StackPanel` will autosize its content `Height` (I used a bit wrongly worded explanation in previous comment), despite `StackPanel` is stretched. The only way to influence `Height` of its children is to set `Height` explicitly. Simply use `Grid` with star-height row as container for usercontrol. – Sinatr May 15 '17 at 14:03

0 Answers0