Live Chat Icon For mobile
Live Chat Icon

How do I make the Expander button to be justified to the right, rather than the left which is the default ?

Platform: WPF| Category: Expander

If you require justifying the Expander button to the right, you need to set the FlowDirection property to RightToLeft.

Note: If you set the FlowDirection to RightToLeft, the content of the expander will also be moved to RightToLeft justification. In order to avoid this, you can set the flow direction to expander content. This can be done with the following code snippets,

[XAML]

<Expander FlowDirection="RightToLeft">
            <Expander.Header>
                <TextBlock Text="Expander header content" Background="AliceBlue"
                           Width="{Binding
                           RelativeSource={RelativeSource
                           Mode=FindAncestor,
                           AncestorType={x:Type Expander}},
                           Path=ActualWidth}"/>
            </Expander.Header>
            <Grid FlowDirection="LeftToRight">
                <TextBlock Background="Gray" Text="Expander body content"/>
            </Grid>
</Expander>

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.