diff --git a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/DataGridExamples.xaml b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/DataGridExamples.xaml index 9a064b0cc9..79ea3d5bf1 100644 --- a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/DataGridExamples.xaml +++ b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/DataGridExamples.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:MetroDemo" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:models="clr-namespace:MetroDemo.Models" xmlns:vc="clr-namespace:MetroDemo.ValueConverter" d:DataContext="{d:DesignInstance local:MainWindowViewModel}" d:DesignHeight="600" @@ -196,10 +197,12 @@ EditingElementStyle="{DynamicResource MahApps.Styles.CheckBox.DataGrid.Win10}" ElementStyle="{DynamicResource MahApps.Styles.CheckBox.DataGrid.Win10}" Header="Album Selected" /> - + + + /// The DependencyProperty for the ' AutoGeneratedCheckBoxColumnStyle property. + /// + /// If a style is set, the DataGridCheckBoxColumn of the DataGrid will use this style for normal cells. + /// public static readonly DependencyProperty AutoGeneratedCheckBoxColumnStyleProperty = DependencyProperty.RegisterAttached("AutoGeneratedCheckBoxColumnStyle", typeof(Style), @@ -20,8 +25,12 @@ public static readonly DependencyProperty AutoGeneratedCheckBoxColumnStyleProper new PropertyMetadata(default(Style))); /// - /// Gets the ElementStyle for the autogenerated DataGridCheckBoxColumn. + /// Helper for getting from . + /// + /// If a style is set, the DataGridCheckBoxColumn of the DataGrid will use this style for normal cells. /// + /// to read from. + /// AutoGeneratedCheckBoxColumnStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static Style GetAutoGeneratedCheckBoxColumnStyle(UIElement element) @@ -30,8 +39,12 @@ public static Style GetAutoGeneratedCheckBoxColumnStyle(UIElement element) } /// - /// Sets the ElementStyle for the autogenerated DataGridCheckBoxColumn. + /// Helper for setting on . + /// + /// If a style is set, the DataGridCheckBoxColumn of the DataGrid will use this style for normal cells. /// + /// to set on. + /// AutoGeneratedCheckBoxColumnStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static void SetAutoGeneratedCheckBoxColumnStyle(UIElement element, Style value) @@ -39,6 +52,11 @@ public static void SetAutoGeneratedCheckBoxColumnStyle(UIElement element, Style element.SetValue(AutoGeneratedCheckBoxColumnStyleProperty, value); } + /// + /// The DependencyProperty for the ' AutoGeneratedCheckBoxColumnEditingStyle property. + /// + /// If a style is set, the DataGridCheckBoxColumn of the DataGrid will use this style for cells in edit mode. + /// public static readonly DependencyProperty AutoGeneratedCheckBoxColumnEditingStyleProperty = DependencyProperty.RegisterAttached("AutoGeneratedCheckBoxColumnEditingStyle", typeof(Style), @@ -46,8 +64,12 @@ public static readonly DependencyProperty AutoGeneratedCheckBoxColumnEditingStyl new PropertyMetadata(default(Style))); /// - /// Gets the EditingElementStyle for the autogenerated DataGridCheckBoxColumn. + /// Helper for getting from . + /// + /// If a style is set, the DataGridCheckBoxColumn of the DataGrid will use this style for cells in edit mode. /// + /// to read from. + /// AutoGeneratedCheckBoxColumnEditingStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static Style GetAutoGeneratedCheckBoxColumnEditingStyle(UIElement element) @@ -56,8 +78,12 @@ public static Style GetAutoGeneratedCheckBoxColumnEditingStyle(UIElement element } /// - /// Sets the EditingElementStyle for the autogenerated DataGridCheckBoxColumn. + /// Helper for setting on . + /// + /// If a style is set, the DataGridCheckBoxColumn of the DataGrid will use this style for cells in edit mode. /// + /// to set on. + /// AutoGeneratedCheckBoxColumnEditingStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static void SetAutoGeneratedCheckBoxColumnEditingStyle(UIElement element, Style value) @@ -65,6 +91,11 @@ public static void SetAutoGeneratedCheckBoxColumnEditingStyle(UIElement element, element.SetValue(AutoGeneratedCheckBoxColumnEditingStyleProperty, value); } + /// + /// The DependencyProperty for the ' AutoGeneratedTextColumnStyle property. + /// + /// If a style is set, the DataGridTextColumn columns of the DataGrid will use this style for normal cells. + /// public static readonly DependencyProperty AutoGeneratedTextColumnStyleProperty = DependencyProperty.RegisterAttached("AutoGeneratedTextColumnStyle", typeof(Style), @@ -72,8 +103,12 @@ public static readonly DependencyProperty AutoGeneratedTextColumnStyleProperty new PropertyMetadata(default(Style))); /// - /// Gets the ElementStyle for the autogenerated DataGridTextColumn. + /// Helper for getting from . + /// + /// If a style is set, the DataGridTextColumn columns of the DataGrid will use this style for normal cells. /// + /// to read from. + /// AutoGeneratedTextColumnStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static Style GetAutoGeneratedTextColumnStyle(UIElement element) @@ -82,8 +117,12 @@ public static Style GetAutoGeneratedTextColumnStyle(UIElement element) } /// - /// Sets the ElementStyle for the autogenerated DataGridTextColumn. + /// Helper for setting on . + /// + /// If a style is set, the DataGridTextColumn columns of the DataGrid will use this style for normal cells. /// + /// to set on. + /// AutoGeneratedTextColumnStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static void SetAutoGeneratedTextColumnStyle(UIElement element, Style value) @@ -91,6 +130,11 @@ public static void SetAutoGeneratedTextColumnStyle(UIElement element, Style valu element.SetValue(AutoGeneratedTextColumnStyleProperty, value); } + /// + /// The DependencyProperty for the ' AutoGeneratedTextColumnEditingStyle property. + /// + /// If a style is set, the DataGridTextColumn of the DataGrid will use this style for cells in edit mode. + /// public static readonly DependencyProperty AutoGeneratedTextColumnEditingStyleProperty = DependencyProperty.RegisterAttached("AutoGeneratedTextColumnEditingStyle", typeof(Style), @@ -98,8 +142,12 @@ public static readonly DependencyProperty AutoGeneratedTextColumnEditingStylePro new PropertyMetadata(default(Style))); /// - /// Gets the EditingElementStyle for the autogenerated DataGridTextColumn. + /// Helper for getting from . + /// + /// If a style is set, the DataGridTextColumn of the DataGrid will use this style for cells in edit mode. /// + /// to read from. + /// AutoGeneratedTextColumnEditingStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static Style GetAutoGeneratedTextColumnEditingStyle(UIElement element) @@ -108,8 +156,12 @@ public static Style GetAutoGeneratedTextColumnEditingStyle(UIElement element) } /// - /// Sets the EditingElementStyle for the autogenerated DataGridTextColumn. + /// Helper for setting on . + /// + /// If a style is set, the DataGridTextColumn of the DataGrid will use this style for cells in edit mode. /// + /// to set on. + /// AutoGeneratedTextColumnEditingStyle property value. [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(DataGrid))] public static void SetAutoGeneratedTextColumnEditingStyle(UIElement element, Style value) @@ -117,6 +169,84 @@ public static void SetAutoGeneratedTextColumnEditingStyle(UIElement element, Sty element.SetValue(AutoGeneratedTextColumnEditingStyleProperty, value); } + /// + /// The DependencyProperty for the ' AutoGeneratedComboBoxColumnStyle property. + /// + /// If a style is set, the DataGridComboBoxColumn columns of the DataGrid will use this style for normal cells. + /// + public static readonly DependencyProperty AutoGeneratedComboBoxColumnStyleProperty + = DependencyProperty.RegisterAttached("AutoGeneratedComboBoxColumnStyle", + typeof(Style), + typeof(DataGridHelper), + new PropertyMetadata(default(Style))); + + /// + /// Helper for getting from . + /// + /// If a style is set, the DataGridComboBoxColumn columns of the DataGrid will use this style for normal cells. + /// + /// to read from. + /// AutoGeneratedComboBoxColumnStyle property value. + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(DataGrid))] + public static Style GetAutoGeneratedComboBoxColumnStyle(UIElement element) + { + return (Style)element.GetValue(AutoGeneratedComboBoxColumnStyleProperty); + } + + /// + /// Helper for setting on . + /// + /// If a style is set, the DataGridComboBoxColumn columns of the DataGrid will use this style for normal cells. + /// + /// to set on. + /// AutoGeneratedComboBoxColumnStyle property value. + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(DataGrid))] + public static void SetAutoGeneratedComboBoxColumnStyle(UIElement element, Style value) + { + element.SetValue(AutoGeneratedComboBoxColumnStyleProperty, value); + } + + /// + /// The DependencyProperty for the ' AutoGeneratedComboBoxColumnEditingStyle property. + /// + /// If a style is set, the DataGridComboBoxColumn of the DataGrid will use this style for cells in edit mode. + /// + public static readonly DependencyProperty AutoGeneratedComboBoxColumnEditingStyleProperty + = DependencyProperty.RegisterAttached("AutoGeneratedComboBoxColumnEditingStyle", + typeof(Style), + typeof(DataGridHelper), + new PropertyMetadata(default(Style))); + + /// + /// Helper for getting from . + /// + /// If a style is set, the DataGridComboBoxColumn of the DataGrid will use this style for cells in edit mode. + /// + /// to read from. + /// AutoGeneratedComboBoxColumnEditingStyle property value. + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(DataGrid))] + public static Style GetAutoGeneratedComboBoxColumnEditingStyle(UIElement element) + { + return (Style)element.GetValue(AutoGeneratedComboBoxColumnEditingStyleProperty); + } + + /// + /// Helper for setting on . + /// + /// If a style is set, the DataGridComboBoxColumn of the DataGrid will use this style for cells in edit mode. + /// + /// to set on. + /// AutoGeneratedComboBoxColumnEditingStyle property value. + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(DataGrid))] + public static void SetAutoGeneratedComboBoxColumnEditingStyle(UIElement element, Style value) + { + element.SetValue(AutoGeneratedComboBoxColumnEditingStyleProperty, value); + } + public static readonly DependencyProperty CellPaddingProperty = DependencyProperty.RegisterAttached("CellPadding", typeof(Thickness), diff --git a/src/MahApps.Metro/Styles/Controls.DataGrid.xaml b/src/MahApps.Metro/Styles/Controls.DataGrid.xaml index d9fe27debe..9dc08d1a26 100644 --- a/src/MahApps.Metro/Styles/Controls.DataGrid.xaml +++ b/src/MahApps.Metro/Styles/Controls.DataGrid.xaml @@ -54,6 +54,32 @@ + +