Skip to content

Instantly share code, notes, and snippets.

@ialexpovad
Last active April 19, 2023 07:00
Show Gist options
  • Save ialexpovad/cdb784c90af36b1c5247f11b756fd724 to your computer and use it in GitHub Desktop.
Save ialexpovad/cdb784c90af36b1c5247f11b756fd724 to your computer and use it in GitHub Desktop.
ToggleButton and Popup instead of Expander.
<Window x:Class="Sandbox.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="900" Width="1100">
<StackPanel>
<StackPanel Margin="20,0,0,0">
<RadioButton Content="Choice One"/>
<RadioButton Content="Choice Two"/>
<RadioButton Content="Choice Three"/>
<RadioButton Content="Choice Four"/>
<RadioButton Content="Choice Five"/>
<RadioButton Content="Choice Six"/>
</StackPanel>
<Canvas MinHeight="25" Panel.ZIndex="99">
<Expander Header="This must stay fixed" ExpandDirection="Up" Width="175">
<Grid Background="Cornsilk">
<Grid.BitmapEffect>
<DropShadowBitmapEffect />
</Grid.BitmapEffect>
<TextBlock TextWrapping="Wrap" Margin="5">
This must expand upwards, not downwards.
The header must remain exactly where it is.
This TextBlock must appear above the header
and overlay the top radio buttons instead.
</TextBlock>
</Grid>
</Expander>
</Canvas>
<StackPanel Margin="20,0,0,0">
<RadioButton Content="Choice One"/>
<RadioButton Content="Choice Two"/>
<RadioButton Content="Choice Three"/>
<RadioButton Content="Choice Four"/>
<RadioButton Content="Choice Five"/>
<RadioButton Content="Choice Six"/>
</StackPanel>
</StackPanel>
</Window>
<Canvas MinHeight="25" Panel.ZIndex="99">
<ToggleButton x:Name="toggle" Content="This must stay fixed" Width="175" />
<Popup Placement="Top" PlacementTarget="{Binding ElementName=toggle}"
IsOpen="{Binding ElementName=toggle, Path=IsChecked}">
<Grid Background="Cornsilk" Width="175">
<Grid.BitmapEffect>
<DropShadowBitmapEffect />
</Grid.BitmapEffect>
<TextBlock TextWrapping="Wrap" Margin="5">
This must expand upwards, not downwards.
The header must remain exactly where it is.
This TextBlock must appear above the header
and overlay the top radio buttons instead.
</TextBlock>
</Grid>
</Popup>
</Canvas>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment