I was wondering if you could help me with something. I'm trying to get stacked plots like this picture.

I'm using UniformGrid to try to get something like this, but it's not correct.
<UniformGrid x:Name="plots" Rows="2">
<StackPanel x:Name="plot1" IsEnabled="False" Visibility="Collapsed">
<Grid MinWidth="300" MinHeight="300">
<WpfPlot x:Name="hr_graph"/>
</Grid>
</StackPanel>
<StackPanel x:Name="plot2" IsEnabled="False" Visibility="Collapsed">
<Grid MinWidth="300" MinHeight="300" >
<WpfPlot x:Name="sat_graph"/>
</Grid>
</StackPanel>
<StackPanel x:Name="plot3" IsEnabled="False" Visibility="Collapsed">
<Grid MinWidth="300" MinHeight="300">
<WpfPlot x:Name="pul_graph"/>
</Grid>
</StackPanel>
<StackPanel x:Name="plot4" IsEnabled="False" Visibility="Collapsed">
<Grid MinWidth="300" MinHeight="300">
<WpfPlot x:Name="per_graph" />
</Grid>
</StackPanel>
</UniformGrid>
You can make this container just a generic
ItemsControl, and change itsItemsPanelaccording to number of visible panels.For example:
That's in plain xaml - I have a slider where you select number of panels to view and according to its value, I change
Visibilityof different panels andItemsPanelas well.If you are changing
Visibilityin code-behind, then you can changeItemsPanelofItemsControlin code-behind as well.So, when you need single panel you set it to simple
Grid, if two panels:UniformGrid 1x2, if three panels:Gridwith two equal rows and two equal columns and pay attention onGrid.Row,Grid.Column,Grid.ColumnSpanproperties defined on panels. For four panels we useUniformGrid 2x2.Hope, that helps.
Important: This will only work if your panels should always be in same order, and for example
Part3can't be visible if `Part2' is hidden. Otherwise, it's a bit more tricky - you will need to dynamically assigned content to parts.UPD: To view
DataTemplateon window you can useContentControl: