// ReSharper disable once CheckNamespace namespace WPFluent.Controls; /// /// Work in progress. /// public class TreeGridHeader : System.Windows.FrameworkElement { /// /// Identifies the dependency property. /// public static readonly DependencyProperty GroupProperty = DependencyProperty.Register( nameof(Group), typeof(string), typeof(TreeGridHeader), new PropertyMetadata(string.Empty)); /// /// Identifies the dependency property. /// public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( nameof(Title), typeof(string), typeof(TreeGridHeader), new PropertyMetadata(string.Empty, OnTitleChanged)); private static void OnTitleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if(d is not TreeGridHeader header) { return; } header.OnTitleChanged(); } /// /// This virtual method is called when is changed. /// protected virtual void OnTitleChanged() { var title = Title; if(!string.IsNullOrEmpty(Group) || string.IsNullOrEmpty(title)) { return; } SetCurrentValue(GroupProperty, title.ToLower().Trim()); } /// /// Gets or sets the column group name. /// [Localizability(LocalizationCategory.NeverLocalize)] [MergableProperty(false)] public string Group { get => (string)GetValue(GroupProperty); set => SetValue(GroupProperty, value); } /// /// Gets or sets the title that will be displayed. /// public string Title { get => (string)GetValue(TitleProperty); set => SetValue(TitleProperty, value); } }