-Games is an ObseverableCollection of Game
-Game.Title, Game.SteamUrl, and Game.ImageUrl are updated via Game.SteamId.set; this update did not reach the PropertyGrid because PropertyGrid only takes a "snapshot" at the time it is bound.
-The selected Game is choosen via WPF ListView
privatevoid lvGames_SelectionChanged(object sender, SelectionChangedEventArgs e)
foreach (Game game in e.AddedItems)
game.PropertyChanged += SelectedGame_PropertyChanged;
foreach (Game game in e.RemovedItems)
game.PropertyChanged -= SelectedGame_PropertyChanged;
privatevoid SelectedGame_PropertyChanged(object sender, PropertyChangedEventArgs e)
Game temp = (Game)lvGames.SelectedItem;
pgGames.SelectedObject = null;
pgGames.SelectedObject = temp;
As you can see, lvGames_SelectionChanged adds PropertyChanged event on selection in the ListView and removes it on deselection. When a Game property raises its INotifyPropertyChanged event, SelectedGame_PropertyChanged is raised. This method takes note of what Game is selected, deselects it (note: this also deselects it in the bound ListView), then reselects it (note: this also selects it in the bound ListView) which causes all of the updated fields to display.
I don't know if there is a way to do this entirely in WPF but this will work in a pinch.
Great work! 4 years after you have create this, i still find it useful.
In my particular case, I have a list of elements that I want to display in a drop down. The list is available as a property within my View Model and the Selected Item in the list is also a property in the view model (lets called it SelectedItem). I created a custom editor to display the list of items in a drop down list(which works well) but am unable to figure out how to tie in the SelectedItem property. When one of the item in the drop down is selected, I want the SelectedItem property to be updated with it. Any ideas?
I tried using this in WF rehosted designer. With subscribing to activity change I was able to still fit into my MVVM pattern so that part is cool.
But I am facing a problem here. The workflow has concept of Arguments (In, Out, InOut ) and in native property inspector these assume VB.NET expression (or if it's not rehosted it allows also C# expressions)
Native PropertyInspector allows you to type the expression or you can open a Editor window (a small dialogue with expression box) and type it there.
Your control blows up on these I tried using custom Editor attribute to display my editor, but your property PropertyGrid even blows up on selecting a field that is of Argument type, What can be done here if anything?