diff --git a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/ButtonsExample.xaml b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/ButtonsExample.xaml index 738c9deae0..6e6ef952a8 100644 --- a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/ButtonsExample.xaml +++ b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/ButtonsExample.xaml @@ -272,7 +272,8 @@ + IsThreeState="True" + Style="{StaticResource MahApps.Metro.Styles.CheckBox.Win10}"/> diff --git a/src/MahApps.Metro/Controls/Helper/CheckBoxHelper.cs b/src/MahApps.Metro/Controls/Helper/CheckBoxHelper.cs index 5b15bf76e6..575392c746 100644 --- a/src/MahApps.Metro/Controls/Helper/CheckBoxHelper.cs +++ b/src/MahApps.Metro/Controls/Helper/CheckBoxHelper.cs @@ -15,11 +15,21 @@ public static class CheckBoxHelper public static readonly DependencyProperty CheckBoxSizeProperty = DependencyProperty.RegisterAttached("CheckBoxSize", typeof(double), typeof(CheckBoxHelper), new FrameworkPropertyMetadata(18.0)); + /// + /// Gets the size of the CheckBox itself. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static double GetCheckBoxSize(DependencyObject obj) { return (double)obj.GetValue(CheckBoxSizeProperty); } + /// + /// Sets the size of the CheckBox itself. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetCheckBoxSize(DependencyObject obj, double value) { obj.SetValue(CheckBoxSizeProperty, value); @@ -34,46 +44,82 @@ public static void SetCheckBoxSize(DependencyObject obj, double value) public static readonly DependencyProperty CheckedBorderBrushProperty = DependencyProperty.RegisterAttached("CheckedBorderBrush", typeof(Brush), typeof(CheckBoxHelper), new FrameworkPropertyMetadata()); + /// + /// Gets the the Glyph for IsChecked = true. + /// + [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static object GetCheckedGlyph(DependencyObject obj) { return (object)obj.GetValue(CheckedGlyphProperty); } + /// + /// Sets the the Glyph for IsChecked = true. + /// [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetCheckedGlyph(DependencyObject obj, object value) { obj.SetValue(CheckedGlyphProperty, value); } + /// + /// Gets the the Background for IsChecked = true. + /// + [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static Brush GetCheckedBackgroundBrush(DependencyObject obj) { return (Brush)obj.GetValue(CheckedBackgroundBrushProperty); } + /// + /// Sets the the Background for IsChecked = true. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetCheckedBackgroundBrush(DependencyObject obj, Brush value) { obj.SetValue(CheckedBackgroundBrushProperty, value); } - + /// + /// Gets the the GlyphTemplate for IsChecked = true. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static DataTemplate GetCheckedGlyphTemplate(DependencyObject obj) { return (DataTemplate)obj.GetValue(CheckedGlyphTemplateProperty); } + /// + /// Sets the the GlyphTemplate for IsChecked = true. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetCheckedGlyphTemplate(DependencyObject obj, DataTemplate value) { obj.SetValue(CheckedGlyphTemplateProperty, value); } + /// + /// Gets the the BorderBrush for IsChecked = true. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static Brush GetCheckedBorderBrush(DependencyObject obj) { return (Brush)obj.GetValue(CheckedBorderBrushProperty); } + /// + /// Sets the the BorderBrush for IsChecked = true. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetCheckedBorderBrush(DependencyObject obj, Brush value) { obj.SetValue(CheckedBorderBrushProperty, value); @@ -90,46 +136,82 @@ public static void SetCheckedBorderBrush(DependencyObject obj, Brush value) public static readonly DependencyProperty UnCheckedBorderBrushProperty = DependencyProperty.RegisterAttached("UnCheckedBorderBrush", typeof(Brush), typeof(CheckBoxHelper), new FrameworkPropertyMetadata()); + /// + /// Gets the the Glyph for IsChecked = false. + /// + [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static object GetUnCheckedGlyph(DependencyObject obj) { return (object)obj.GetValue(UnCheckedGlyphProperty); } + /// + /// Sets the the Glyph for IsChecked = false. + /// [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetUnCheckedGlyph(DependencyObject obj, object value) { obj.SetValue(UnCheckedGlyphProperty, value); } + /// + /// Gets the the BackgroundBrush for IsChecked = false. + /// + [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static Brush GetUnCheckedBackgroundBrush(DependencyObject obj) { return (Brush)obj.GetValue(UnCheckedBackgroundBrushProperty); } + /// + /// Sets the the BackgroundBrush for IsChecked = false. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetUnCheckedBackgroundBrush(DependencyObject obj, Brush value) { obj.SetValue(UnCheckedBackgroundBrushProperty, value); } - + /// + /// Gets the the GlyphTemplate for IsChecked = false. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static DataTemplate GetUnCheckedGlyphTemplate(DependencyObject obj) { return (DataTemplate)obj.GetValue(UnCheckedGlyphTemplateProperty); } + /// + /// Sets the the GlyphTemplate for IsChecked = false. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetUnCheckedGlyphTemplate(DependencyObject obj, DataTemplate value) { obj.SetValue(UnCheckedGlyphTemplateProperty, value); } + /// + /// Gets the the BorderBrush for IsChecked = false. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static Brush GetUnCheckedBorderBrush(DependencyObject obj) { return (Brush)obj.GetValue(UnCheckedBorderBrushProperty); } + /// + /// Sets the the BorderBrush for IsChecked = false. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetUnCheckedBorderBrush(DependencyObject obj, Brush value) { obj.SetValue(UnCheckedBorderBrushProperty, value); @@ -146,46 +228,82 @@ public static void SetUnCheckedBorderBrush(DependencyObject obj, Brush value) public static readonly DependencyProperty IntermediateBorderBrushProperty = DependencyProperty.RegisterAttached("IntermediateBorderBrush", typeof(Brush), typeof(CheckBoxHelper), new FrameworkPropertyMetadata()); + /// + /// Gets the the Glyph for IsChecked = null. + /// + [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static object GetIntermediateGlyph(DependencyObject obj) { return (object)obj.GetValue(IntermediateGlyphProperty); } + /// + /// Sets the the Glyph for IsChecked = null. + /// [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetIntermediateGlyph(DependencyObject obj, object value) { obj.SetValue(IntermediateGlyphProperty, value); } + /// + /// Gets the the BackgroundBrush for IsChecked = null. + /// + [Category(AppName.MahApps)] [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static Brush GetIntermediateBackgroundBrush(DependencyObject obj) { return (Brush)obj.GetValue(IntermediateBackgroundBrushProperty); } + /// + /// Sets the the BackgroundBrush for IsChecked = null. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetIntermediateBackgroundBrush(DependencyObject obj, Brush value) { obj.SetValue(IntermediateBackgroundBrushProperty, value); } - + /// + /// Gets the the GlyphTemplate for IsChecked = null. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static DataTemplate GetIntermediateGlyphTemplate(DependencyObject obj) { return (DataTemplate)obj.GetValue(IntermediateGlyphTemplateProperty); } + /// + /// Sets the the GlyphTemplate for IsChecked = null. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetIntermediateGlyphTemplate(DependencyObject obj, DataTemplate value) { obj.SetValue(IntermediateGlyphTemplateProperty, value); } + /// + /// Gets the the BorderBrush for IsChecked = null. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static Brush GetIntermediateBorderBrush(DependencyObject obj) { return (Brush)obj.GetValue(IntermediateBorderBrushProperty); } + /// + /// Sets the the BorderBrush for IsChecked = null. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] public static void SetIntermediateBorderBrush(DependencyObject obj, Brush value) { obj.SetValue(IntermediateBorderBrushProperty, value); @@ -193,7 +311,5 @@ public static void SetIntermediateBorderBrush(DependencyObject obj, Brush value) #endregion - - } } diff --git a/src/MahApps.Metro/Converters/DoubleToGridLengthConverter.cs b/src/MahApps.Metro/Converters/DoubleToGridLengthConverter.cs new file mode 100644 index 0000000000..d6a91452b1 --- /dev/null +++ b/src/MahApps.Metro/Converters/DoubleToGridLengthConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace MahApps.Metro.Converters +{ + public class DoubleToGridLengthConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return new GridLength((double)value, GridUnitType.Pixel); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/MahApps.Metro/Styles/Controls.CheckBox.xaml b/src/MahApps.Metro/Styles/Controls.CheckBox.xaml index 8865c7c073..fb04376ed5 100644 --- a/src/MahApps.Metro/Styles/Controls.CheckBox.xaml +++ b/src/MahApps.Metro/Styles/Controls.CheckBox.xaml @@ -1,7 +1,10 @@  + xmlns:Controls="clr-namespace:MahApps.Metro.Controls" + xmlns:Converter="clr-namespace:MahApps.Metro.Converters"> + + +