Av Mx

Av Mx

  • NA
  • 16
  • 2k

Binding Combobox selection to Togglebutton IsChecked propert

Feb 16 2017 8:23 AM
I am working on an application for a company - cannot disclose full information on the project but I will try and be descriptive enough. I have a WPF project, I use MVVM, where a user logins in, makes a selection on a combobox, checks Togglebuttons and saves that link by pressing a Button.
 
For your understanding I will make an example of a team pf players. Combobox has Team A,B,C and the Togglebuttons are the names of the players. User selects Team A and selects players John and Dave for that team and presses save - this is saved to an xml file. When the Togglebutton is checked, it changes color. Now when the user opens the App again, selects Team A from the Combobox, the players that were already selected should appear as checked - change color.How can I achieve this using MVVM? The ViewModel side works fine - I can get the names of players that are linked to current selection of Combobox but I don't know how to bind this to the Togglebutton.
P.S. this link http://www.dotnetlead.com/wpf-organization-chart/application-and-source-code is an example I took this from, it will help you understand what I'm talking about - the selection of the button especially.
 
Your help will be highly appreciated. Even if it is a theoretical explanation I will figure out the code.
I'm new here, I hope I posted under the right subject, if not, please advise.
 

Answers (2)