Let's assume i have the following class:
class SimpleData
{
public string DisplayName { get; set; }
public bool IsDefault { get; set; }
}
Now i've stored a list of SimpleData
in a list and set the list as DataContext
. I have binded to the lit like this:
<ComboBox x:Name="layoutComboBox" VerticalAlignment="Center" Padding="3,0,3,0" Height="20" Margin="3,0,0,0" MinWidth="100"
ItemsSource="{Binding Path=GridConfigurationProfiles}"
DisplayMemberPath="DisplayName"
SelectedValuePath="IsDefault"
/>
Which works pretty well for the DisplayMemberPath
, but i don't get the item selected as default, which has IsDefault = True
.
The question: how to bind SelectedValue
to True
so the item will be selected, which has IsDefault = True
. If the condition is for more than one item true, the system should take what ever it want's to.
Thank you.