Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new attached property TreeViewItemHelper.ToggleButtonStyle #3712

Merged
merged 1 commit into from
Dec 12, 2019

Conversation

punker76
Copy link
Member

@punker76 punker76 commented Dec 12, 2019

Add this new attached property to make it possible to set the inner ToggleButton style. The default is MahApps.Styles.ToggleButton.ExpandCollapse.

Sample

<Style BasedOn="{StaticResource MahApps.Styles.TreeViewItem}" TargetType="{x:Type TreeViewItem}">
    <Setter Property="controls:TreeViewItemHelper.ToggleButtonStyle">
        <Setter.Value>
            <Style BasedOn="{StaticResource MahApps.Styles.ToggleButton.ExpandCollapse}" TargetType="{x:Type ToggleButton}">
                <Setter Property="Visibility" Value="Hidden" />
            </Style>
        </Setter.Value>
    </Setter>
</Style>

or

<Style x:Key="SpecialCustomTreeViewItemToggleButtonStyle" BasedOn="{StaticResource MahApps.Styles.ToggleButton.ExpandCollapse}" TargetType="{x:Type ToggleButton}">
    <Setter Property="Visibility" Value="Hidden" />
</Style>

<Style BasedOn="{StaticResource MahApps.Styles.TreeViewItem}" TargetType="{x:Type TreeViewItem}">
    <Setter Property="controls:TreeViewItemHelper.ToggleButtonStyle" Value="{StaticResource SpecialCustomTreeViewItemToggleButtonStyle}"  />
</Style>

or

<TreeView Margin="2">
    <TreeViewItem Header="Item 1"
                  Controls:TreeViewItemHelper.ToggleButtonStyle="{StaticResource SpecialCustomTreeViewItemToggleButtonStyle}">
        <TreeViewItem Header="Item 1.1">
            <TreeViewItem Header="Item 1.1.1" />
            <TreeViewItem Header="Item 1.1.2" />
        </TreeViewItem>
        <TreeViewItem Header="Item 1.2" />
        <TreeViewItem Header="Item 1.3" />
    </TreeViewItem>
</TreeView>

Add this new attached property to make it possible to set the inner ToggleButton style. The default is `MahApps.Styles.ToggleButton.ExpandCollapse`.
@punker76 punker76 added this to the 2.0.0 milestone Dec 12, 2019
@punker76 punker76 merged commit 9cd7028 into develop Dec 12, 2019
@punker76 punker76 deleted the features/TreeViewItemHelper branch December 12, 2019 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant