How do I anchor an expander to right side of a ListBox?
Posted
by Scott
on Stack Overflow
See other posts from Stack Overflow
or by Scott
Published on 2009-11-09T20:44:41Z
Indexed on
2010/05/12
8:04 UTC
Read the original article
Hit count: 226
The XAML code below works fine except I want the expander button to be between the listbox and the grid. If I set the ExpandDirection="Left" the button is between the listbox and the grid but the direction indicator on the button is confusing to users - it point to the right when expanded and it points to the left when it is not expanded. I want the direction indicator to work the way it does when ExpandDirection="Right" but I want the functionality of ExpandDirection="Left".
<DockPanel>
<Expander ExpandDirection="Right">
<ListBox>
<ListBoxItem>Item One</ListBoxItem>
<ListBoxItem>Item Two</ListBoxItem>
<ListBoxItem>Item Three</ListBoxItem>
<ListBoxItem>Item Four</ListBoxItem>
<ListBoxItem>Item Five</ListBoxItem>
</ListBox>
</Expander>
<Grid Background="AliceBlue">
<TextBlock >
Other Content
</TextBlock>
</Grid>
</DockPanel>
© Stack Overflow or respective owner