Browse Source

Show a Rectangle when a Property is set!

(like in the VS2012 Property Grid)
pull/52/head
jkuehner 12 years ago
parent
commit
569f8629d1
  1. 39
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs
  2. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml

39
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs

@ -9,6 +9,7 @@ using System.Windows.Data; @@ -9,6 +9,7 @@ using System.Windows.Data;
using System.Globalization;
using System.Windows;
using System.Collections;
using System.Windows.Media;
namespace ICSharpCode.WpfDesign.Designer.Converters
{
@ -85,7 +86,7 @@ namespace ICSharpCode.WpfDesign.Designer.Converters @@ -85,7 +86,7 @@ namespace ICSharpCode.WpfDesign.Designer.Converters
{
if (value == null || (int)value == 0) {
return Visibility.Collapsed;
}
}
return Visibility.Visible;
}
@ -145,17 +146,35 @@ namespace ICSharpCode.WpfDesign.Designer.Converters @@ -145,17 +146,35 @@ namespace ICSharpCode.WpfDesign.Designer.Converters
}
public class FormatDoubleConverter : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly FormatDoubleConverter Instance=new FormatDoubleConverter();
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly FormatDoubleConverter Instance=new FormatDoubleConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Math.Round((double)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Math.Round((double)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
public class BlackWhenTrue : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly BlackWhenTrue Instance = new BlackWhenTrue();
private Brush black = new SolidColorBrush(Colors.Black);
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? black : null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml

@ -199,6 +199,7 @@ @@ -199,6 +199,7 @@
Style="{StaticResource ExpandButtonStyle}"
IsChecked="{Binding IsExpanded}"
Visibility="{Binding HasChildren, Converter={x:Static Converters:HiddenWhenFalse.Instance}}" />
<Rectangle Width="8" Height="8" Stroke="Black" Fill="{Binding IsSet, Converter={x:Static Converters:BlackWhenTrue.Instance}}" StrokeThickness="1" DockPanel.Dock="Right" Margin="4,0,4,0" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Name}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"

Loading…
Cancel
Save