2

Expander should be the HeaderText on the left and the ToggleButton on right side.

I try to set the ToggleButton to the default style, without to create a new completly ControlTemplate for it.

Can someone help?

<ControlTemplate TargetType="Expander" x:Key="ExpanderControlx"> <Grid Margin="0"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Name="ContentRow" Height="0"/> </Grid.RowDefinitions> <Border Grid.Row="0" > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="20"/> </Grid.ColumnDefinitions> <ToggleButton Grid.Column="1" IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" OverridesDefaultStyle="True" Template="{StaticResource {x:Type ToggleButton}}" /> <TextBlock Grid.Column="0" Eddie.TextFormat="Header1" Text="{TemplateBinding Header}" HorizontalAlignment="Left" /> </Grid> </Border> <Border Grid.Row="1" Name="ContentText" > <StackPanel> <ContentPresenter/> </StackPanel> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsExpanded" Value="True"> <Setter TargetName="ContentRow" Property="Height" Value="{Binding ElementName=ContentText, Path=Height}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="controls:ExpanderControl"> <Setter Property="Template" Value="{StaticResource ExpanderControlx}" /> </Style> 
4
  • I try to set the Template of the ToggleButton to the Static Resource of ToggleButton, but I got an error. Commented Aug 9, 2018 at 12:30
  • 3
    How does the ToggleButton currently look like and how do you expect it to look? Commented Aug 9, 2018 at 12:59
  • So you want the whole row to be a Toggle button but have the visual for the Toggle just be on the right hand side? It's unclear what you're asking, sounds like a quick template though. Commented Aug 9, 2018 at 13:54
  • The Togglebutton should look like the default button of an normal extender. Only the field of the upper rights side should have the normal extender button. If i delete in the code the row of allocation to the override template of the togglebutton, it show a rectangular button with no arrow. Commented Aug 9, 2018 at 14:04

1 Answer 1

0

From the comments I think you are looking for an Expander whose header is on the left and arrow button (toggle) on the right.

enter image description here

If so, you could use the Expander from Material Design toolkit linked here.

You could also explore more of the Material Design toolkit here.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.