I am working on a Prism WPF project and I have a RadExpander in the shell of my project.
<Grid> <Grid> <ContentControl prism:RegionManager.RegionName="ContentRegion" /> <tel:RadExpander x:Name="MenuFlyOut" IsExpanded="True" tel:AnimationManager.IsAnimationEnabled="True" ExpandDirection="Right" Width="210" Background="CornflowerBlue" Margin="0,0,159,0"> <tel:RadExpander.Header> <TextBlock x:Name="ExpanderCaption" Text="Menu" Foreground="White"/> </tel:RadExpander.Header> <tel:RadExpander.Content> <StackPanel Margin="10,20,0,0" Width="200" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="1"> //Button that opens UserControl in ContentRegion //stuff in the stackpanel </StackPanel> </tel:RadExpander.Content> </tel:RadExpander> </Grid> </Grid>Currently since the RadExpander IsExpanded is set to "true" when the UserControl loads, the RadExpander is, obviously, still expanded. What I am trying to do is change the state of IsExpanded when the UserControl finishes loading.
my latest attempt was to set it in the codebehind of the UserControl:
public partial class UserControlContent : UserControl{ public UserControlContent() { InitializeComponent(); var setExpander = new Shell(); setExpander.MenuFlyOut.IsExpanded = false; }}But that didn't work.. I've tried a few other ways to do this. Event Triggers, Binding to a property which calls a method that sets IsExpanded.
Obviously, I'm missing something, and help would be appreciated.
