Notification of ColorEditBox value changed in a PorpertyGrid

Grids for WPF Forum

Posted 4 years ago by Martin Kleiman - CEO, Meaningful Bytes
Version: 15.1.0620
Avatar

I am a PowerShell user so I want to get notfication of a change to the value of a ColorEditBox.  The following is a subset of XAML code I am using which is loaded at runtime.

<propgrid:PropertyGridPropertyItem ValueName="Property6" DisplayName="Property 6" Value="Value3" DefaultValue="Value3"
Description="This is the third property." Category="Category2" />

<propgrid:PropertyGridPropertyItem x:Name="ColorItem" DisplayName="ColorEditBox" Description="A ColorEditBox used to modify a Color." ValueName="Property7">

<propgrid:PropertyGridPropertyItem.ValueTemplate>

<DataTemplate>
<editors:ColorEditBox x:Name="editBox" Value="{x:Static Colors.Blue}">
</editors:ColorEditBox>
</DataTemplate>
</propgrid:PropertyGridPropertyItem.ValueTemplate>
</propgrid:PropertyGridPropertyItem>

 

My PowerShell app can detect the change to Property6 using the PropertyChanged Event but I cannot see any changes to the ColorEditBox.

 

The reason I am using PowerShell is based on my customer's requirements so I cannot use C# or VB.  Any thoughts?

Comments (3)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

H Martin,

Your ColorEditBox is having its value set to an explicit value, so it's not interacting with the PropertyGrid's data accessor.  The data accessor is what provides access to the actual property data.  If you take a look at our CustomPropertyEditor QuickStart's MainControl.xaml, you can see examples of a couple ValueTemplates there.  Look at the HorizontalListBox.SelectedValue binding in that file since it shows how you properly bind the property Value.  You'd want to use a similar binding on the ColorEditBox.Value property.


Actipro Software Support

Posted 4 years ago by Martin Kleiman - CEO, Meaningful Bytes
Avatar

I will try that and let you know how it works.  Thank you.

Posted 4 years ago by Martin Kleiman - CEO, Meaningful Bytes
Avatar

That worked great.  Thank you.

The latest build of this product (v2018.1 build 0675) was released 15 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.