update property in propertyGrid from ViewModel

Grids for WPF Forum

Posted 5 years ago by Sasha
Version: 14.2.0611
Avatar

Hi,

I have a customFactory to show properties in propertyGrid. It it the same like in example. Also I would like to update property from viewModel. With default key (BuiltinEditors.DynamicStringValueTemplateKey) the property is updated in viewModel, but not in propertyGrid. So I've created customKey:

<DataTemplate x:Key="{x:Static viewModels:CustomFactory.NormalInOperationTemplateKey}">
    <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.Normal}" />
</DataTemplate>

 Now everything is updated in the viewModel and in the propertyGrid.

Is it a good way to resolve this issue? Is there a better way of solving it?

Comments (4)

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

Hi Sasha,

While it may work, that's not really a good way to resolve the issue since it's skipping over the entire PropertyGrid data model.  I would check to see if the value gets updated when you don't use a custom factory, if that is possible.  There must be some sort of change notification not getting passed up to the UI end.  That check would tell you if its something with your custom factory.


Actipro Software Support

Posted 5 years ago by Sasha
Avatar

I built a small example, almost like in your sample. It's updates values without customFactory and not updates them with customFactory. But we prefer to use customPropertyGrid because we already made a lot of customatization... So can you look at your customFactory? Or we can open a ticket and send you this small sample? Our version of Actipro is not the latest(14.2.610.0), can it cause a problem?

Posted 5 years ago by Sasha
Avatar

With new version of Actipro we have the same issue.

[Modified 5 years ago]

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

You have this other ticket open where you mention using CachedPropertyDataAccessorBase and I wonder if you are using that here as well, and it's the value getting cached without you telling the cache flag to clear.  Please see the writeup we just did in reply to that other ticket and see if that response helps you, since it talks about how to clear the flag.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.