I have
class Student
{
public List<Degree> Degrees {get;set;}
}
class Degree
{
public Subject Subject{get;set;}
public int Value {get;set;}
}
class Subject
{
English =0,
Germany = 1,
Biology=2
}
And I have a Treeview
<HierarchicalDataTemplate DataType="{x:Type MyService:Student}" >
<TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="English: "/>
<CheckBox IsChecked="{Binding Path=Degrees.Where(d=>d.Subject==English).First()}, Converter={StaticResource degreeToBoolIsPassed}"> </CheckBox>
<TextBlock TextAlignment="Justify" VerticalAlignment="Center" Text="Germany: "/>
<CheckBox IsChecked="{Binding Path=Degrees.Where(d=>d.Subject==Germany).First()}, Converter={StaticResource degreeToBoolIsPassed}"> </CheckBox>
etc
Architecture of classed couldn't be change ,degreeToBoolIsPassed is easy to do, so I'm only want to xaml from you, or .cs of this control. I know that:
<CheckBox IsChecked="{Binding Path=Degrees.Where(d=>d.Subject==Germany).First()}, Converter={StaticResource degreeToBoolIsPassed}"> </CheckBox>
doesn't work. It is only example what I want.
Important thing:
Every student must have 4 checkboxes