-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3712 from MahApps/features/TreeViewItemHelper
Add new attached property TreeViewItemHelper.ToggleButtonStyle
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.ComponentModel; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace MahApps.Metro.Controls | ||
{ | ||
public static class TreeViewItemHelper | ||
{ | ||
public static readonly DependencyProperty ToggleButtonStyleProperty | ||
= DependencyProperty.RegisterAttached( | ||
"ToggleButtonStyle", | ||
typeof(Style), | ||
typeof(TreeViewItemHelper), | ||
new FrameworkPropertyMetadata((Style)null, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure)); | ||
|
||
/// <summary> | ||
/// Gets the toggle button style used for the TreeViewItem expander. | ||
/// </summary> | ||
[Category(AppName.MahApps)] | ||
[AttachedPropertyBrowsableForType(typeof(TreeViewItem))] | ||
public static Style GetToggleButtonStyle(UIElement element) | ||
{ | ||
return (Style)element.GetValue(ToggleButtonStyleProperty); | ||
} | ||
|
||
/// <summary> | ||
/// Sets the toggle button style used for the TreeViewItem expander. | ||
/// </summary> | ||
[Category(AppName.MahApps)] | ||
[AttachedPropertyBrowsableForType(typeof(TreeViewItem))] | ||
public static void SetToggleButtonStyle(UIElement element, Style value) | ||
{ | ||
element.SetValue(ToggleButtonStyleProperty, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters