This project has moved and is read-only. For the latest updates, please go here.

PropertyGrid Value Bind Problem

Oct 6, 2012 at 11:26 AM
Edited Oct 6, 2012 at 12:55 PM

Pretty simple propertygrid bound to an item (works fine); 

<xctk:PropertyGrid  SelectedObject="{Binding Path=SelectedObject}" ...

and the DataModel I set it to has some integer properties;

[DisplayName("Track Columns")]
[Description("Number of Columns in the Log View")]
public int TrackColumns
        return ViewModel.TrackColumns;
        ViewModel.TrackColumns = value;

The problem is that the default editor in the PropertyGrid doesn't behave properly. Firstly there is no where that I can see to change when it updates the value; I want it to bind with immediate effect - change the valid in any way and it sets the DataModel Property. So if you type a number and press enter, it doesn't update the value either at the moment. Secondly, If you press the "up" or "down" button once, it updates the value, press it twice or more and it stops updating the value until you press the opposite button, etc... 

Any work around?



Oct 9, 2012 at 4:51 PM

You could try to create your own CustomEditor thru the PropertyGrid.EditorDefinitions

Set the TargeType to "Int32" and use an IntegerUpDown in the DataTemplate.

When adding the binding, specify "PropertyChanged" as update source trigger (e.g. {Binding Value, UpdateSourceTrigger=PropertyChanged})