How to use Blend or VS Designer to edit default style template for WPF PropertyGrid

I am using NuGet's Extended WPF Toolkit Community Edition v2.6 in my project, but I don’t know if there is anything else to do to allow me to create themes or customize the control template.

Upon requesting Designer / Blend to create a copy of the existing default template for the PropertyGrid, the user interface is violated. The template looks right, but no longer works at design time or at run time.

enter image description here

After selecting, copy the default template to the new style:

Image

? / PropertyGrid.

XAML :

<Style TargetType="{x:Type xctk:DropDownButton}">
  <Setter Property="Background" Value="Black"/>
  <Setter Property="Foreground" Value="White"/>
</Style>
<Style TargetType="{x:Type xctk:CustomPropertyItem}">
  <Setter Property="Background" Value="Black"/>
  <Setter Property="Foreground" Value="White"/>
</Style>
<Style TargetType="{x:Type xctk:PropertyGridEditorCollectionControl}">
  <Setter Property="Background" Value="Black"/>
  <Setter Property="Foreground" Value="White"/>
</Style>

, , " ". VS Designer Blend.

enter image description here

:

Error from Copy Style

generic.xaml Xceed Toolkit, .

:

<ResourceDictionary Source="/Xceed.Wpf.Toolkit;component/themes/generic.xaml" />

<ResourceDictionary Source="pack://application:,,,/Xceed.Wpf.Toolkit;component/Themes/generic.xaml">

, PropertyContainerStyle:

stack trace

+4
2

PropertyGrid contol Xceed.Wpf.Toolkit.dll, WPF ( note, <Grid x:Name="RootGrid" /> xaml, ):

        var type = Assembly.LoadFile(@"C:\path\to\file\Xceed.Wpf.Toolkit.dll")
            .GetType("Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid");

        // Instantiate the type.
        var info = type.GetConstructor(Type.EmptyTypes);
        var control = (Control)info.Invoke(null);

        // Add it to the grid (but keep it hidden).
        control.Visibility = Visibility.Collapsed;
        this.RootGrid.Children.Add(control);

        // Get the template.
        var template = control.Template;

        // Get the XAML for the template.
        var settings = new XmlWriterSettings();
        settings.Indent = true;
        var sb = new StringBuilder();
        var writer = XmlWriter.Create(sb, settings);
        XamlWriter.Save(template, writer);

        // Display the template any appropriate way.
        Trace.Write(sb.ToString());

xaml sb.ToString() / PropertyGrid .

0

" " Blend . PropertyItems PropertyGrid , ItemsSource .

"PART_PropertyItemsControl" "PropertyGrid": ItemsSource. : ItemsSource = "{ , RelativeSource = {RelativeSource TemplatedParent}}" PropertyItems.

0

All Articles