How to override or change Expander, move icon to left side

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 5 years ago by Matthew Eshleman
Version: 14.2.0610
Avatar

I have inherited a wpf project from a departed engineer. This project is using actipro for various features, including Themes. I'm also new to wpf/xaml, although I have plenty of C# experience.

One view is using an Expander. The xaml is just this simple:

//in resources:
<Style x:Key="DataFileListContainerStyle" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander Header="{Binding Name}" IsExpanded="True">
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<ListBox BorderThickness="0"
ItemsSource="{Binding Files}" SelectedValue="{Binding SelectedDataFile}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="1,1,1,1">
<TextBlock.Text>
<Binding Path="FilePath"/>
</TextBlock.Text>
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource DataFileListContainerStyle}"/>
</ListBox.GroupStyle>
</ListBox> 

 

The problem is the default actipro expander has the expand icon all the way on the right, which in some cases is "off screen". I would prefer the icon to always be on the left, same as the default wpf expander. How do I do this? 

Comments (1)

Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Matthew,

You would need to provide a custom Expander template to achieve this alternate look.  If you take a peek at our "AnimatedExpander" demo's source in the Sample Browser, you can see an example of making custom templates for this control.  That should help you out.  The ToggleButton portion is the main part you'd want to alter from the default style.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.