Like described in the title, i'd like to link 2 users control. one is a list and an other one is detail of list. I'd like to refresh the detail user control depending on the row selected in my first user control
Are there a way to do this?
Like described in the title, i'd like to link 2 users control. one is a list and an other one is detail of list. I'd like to refresh the detail user control depending on the row selected in my first user control
Are there a way to do this?
You could have a DependencyProperty
on the "List" control which exposes the selected item. Then bind this as the DataContext
of the second control.
public YourType SelectedItem
{
get { return (YourType)this.GetValue(SelectedItemProperty); }
set { this.SetValue(SelectedItemProperty, value); }
}
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register(
"SelectedItem", typeof(YourType), typeof(YourListControl));
WPF something like:
<local:YourListControl SelectedItem={Binding SelectedRow, Mode=TwoWay}/>
<local:DetailControl DataContext={Binding SelectedRow}/>
Where SelectedRow
would be on your viewmodel
i'm really disapointed with your solutions. it's difficult for me to understand how it communicates between both usercontrol. throw the viewmodel containing the usercontrol or the view?
Do you have a minimal sample that i could learn and test for my case?