
Hi,
#1
I am adding Custom editor in the property grid in the following manner.
The values which i have to display in combo are in the ITEM.Value (can change the format)
But i am not getting that how to set values in the editor.
Data template in resource dictionary
#2
Now suppose, I have Combo box as custom editor with 5 values and displaying in property grid. Now on any event How can I change value of combo which is at other than first index.
if you have sample code for above issue please send me, its very urgent.
Thanks
Anurodh
#1
I am adding Custom editor in the property grid in the following manner.
The values which i have to display in combo are in the ITEM.Value (can change the format)
But i am not getting that how to set values in the editor.
Data template in resource dictionary
<DataTemplate x:Key="test">
<Grid>
<TextBox Grid.Column="0" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderThickness="0"
Text="{Binding Value, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}" />
</Grid>
</DataTemplate>
PropertyGridPropertyItem item = new PropertyGridPropertyItem();
item.DisplayName = "MyComboBox";
item.Value = "1,2,3";
item.Description = "This is sample combobox property";
item.Category = "My Properties:";
// Here I have to create FrameworkElementFactory to make this element value type ComboBox.
FrameworkElementFactory fact = new FrameworkElementFactory(typeof(ComboBox),
"ctlCombo");
DataTemplate dataTemplate = new DataTemplate();
dataTemplate.Resources.Add(typeof(DataTemplate), this.FindResource("test"));
dataTemplate.VisualTree = fact;
item.ValueTemplate = dataTemplate;
// Finally Add it to Properties Collection.
propGrid.Properties.Add(item);
// How can I add items on ComboBox which is created above?
Now suppose, I have Combo box as custom editor with 5 values and displaying in property grid. Now on any event How can I change value of combo which is at other than first index.
if you have sample code for above issue please send me, its very urgent.
Thanks
Anurodh