Hello,
I'm binding to multiple items using PropertySetMode="Intersection" and CurrentPropertySet. Changes to the properties from the PropertyGrid combobox work as expected, but changes to the objects from anywhere else in the application do not cause the PropertyGrid to update until the item selection is refreshed. The objects implement INotifyPropertyChanged. Is there something else I'm missing to get the changes to be shown in the PropertyGrid?
Here is some of the relevant XAML and my view model:
<DataTemplate x:Key="TemplateComboBoxTemplate"> <telerik:RadComboBox ItemsSource="{Binding Clubs, Source={StaticResource MyViewModel}}" SelectedValue="{Binding CurrentPropertySet[ClubID], Mode=TwoWay}" SelectedValuePath="ID" DisplayMemberPath="Name" Margin="0"> </telerik:RadComboBox></DataTemplate><telerik:RadPropertyGrid Item="{Binding Players}" PropertySetMode="Intersection"AutoGeneratePropertyDefinitions="True" AutoGeneratingPropertyDefinition="RadPropertyGrid_AutoGeneratingPropertyDefinition"/>
public class MyViewModel : INotifyPropertyChanged{ public event PropertyChangedEventHandler PropertyChanged; private ObservableCollection<Club> clubs; private ObservableCollection<Player> players; private List<Player> playersTemp = new List<Player>(); public MyViewModel() { clubs = new ObservableCollection<Club>(); Club club; // Liverpool club = new Club("Liverpool", new DateTime(1892, 1, 1), 45362, 1); club.Players.Add(new Player("Pepe Reina", 25, Position.GK, "Spain", 1, true)); clubs.Add(club); // Manchester Utd. club = new Club("Manchester Utd.", new DateTime(1878, 1, 1), 76212, 2); club.Players.Add(new Player("Edwin van der Sar", 1, Position.GK, "Netherlands", 2, false)); clubs.Add(club); // Chelsea club = new Club("Chelsea", new DateTime(1905, 1, 1), 42055, 3); club.Players.Add(new Player("Petr ÄŒech", 1, Position.GK, "Czech Republic", 3, true)); clubs.Add(club); // Arsenal club = new Club("Arsenal", new DateTime(1886, 1, 1), 60355, 4); club.Players.Add(new Player("Manuel Almunia", 1, Position.GK, "Spain", 4, false)); clubs.Add(club); players = new ObservableCollection<Player>(clubs.SelectMany(c => c.Players)); } public ObservableCollection<Club> Clubs { get { return this.clubs; } } public ObservableCollection<Player> Players { get { return this.players; } } internal void ClearPlayers() { playersTemp.AddRange(players); players.Clear(); OnPropertyChanged(nameof(Players)); } internal void SelectPlayers() { foreach (var player in playersTemp) { players.Add(player); } playersTemp.Clear(); OnPropertyChanged(nameof(Players)); } protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { handler(this, args); } } private void OnPropertyChanged(string propertyName) { this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); }}I prepared a sample project starting from another sample I found on this forum but I was unable to upload. I can provide this if it helps.
Thanks for any help you can offer!
