Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: Propertygrid Editor Style Override [22428]

$
0
0
Hi,

i am trying to override the propertygrid's style. Therefore i modified the generic.xaml.
Now i have the problem that the defaulteditors styles are not overridden.
Therefore i wrote following style to override the PropertyGridEditorComboBox in Xaml:

```
<Style TargetType="{x:Type xctk:PropertyGridEditorComboBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<ComboBox SelectedItem="{Binding Value}" ItemsSource="{?????}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

```
This snippet seems to work except the fact that i do not know what i have to bind as an itemssource. What do i have to bind as Itemssource?

If there is also a better way to override the DefaultEditors appearance please let me know.

KR Manuel
Comments: ** Comment from web user: BoucherS **

Hi,

You can do this :
```
public enum Directions
{
North,
East,
South,
West
}

<Window.Resources>
<ObjectDataProvider x:Key="DirectionsValues"
MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:Directions" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
<Grid>
<xctk:PropertyGrid SelectedObject="{Binding}">
<xctk:PropertyGrid.EditorDefinitions>
<xctk:EditorTemplateDefinition TargetProperties="Directions">
<xctk:EditorTemplateDefinition.EditingTemplate>
<DataTemplate>
<ComboBox SelectedValue="{Binding Value}"
ItemsSource="{Binding Source={StaticResource DirectionsValues}}"
Foreground="Green"/>
</DataTemplate>
</xctk:EditorTemplateDefinition.EditingTemplate>
</xctk:EditorTemplateDefinition>
</xctk:PropertyGrid.EditorDefinitions>
</xctk:PropertyGrid>
</Grid>
```

――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>