I have a listview, when selecting the listview I make a binding to an SelectedCategory property.
When binding to Checkbox, Textbox an so works fine, but I can't find the right combination for the ComboBox no matter what I try.
I know for sure, that the ProjectName exists AND is binded correctly to the SelectedCategory (I have made a button and before that display the ProjectId and ProjectName).
I hope one of You can see, where I'm doing something wrong
Best regards
Simsen :-)
My ListView looks like this
<ListView x:Name="LivCategories" ItemsSource="{Binding Categories_GetActive}" SelectedItem="{Binding SelectedCategory}" Grid.Row="0" Grid.Column="0">
<ListView.View>
<GridView>
<GridViewColumn Header="Id" Width="50" DisplayMemberBinding="{Binding CategoryId}"/>
<GridViewColumn Header="Navn" Width="250" DisplayMemberBinding="{Binding CategoryName}"/>
<GridViewColumn Header="Global" Width="50" DisplayMemberBinding="{Binding CategoryIsGlobal}"/>
<GridViewColumn Header="Project" Width="150" DisplayMemberBinding="{Binding ProjectName}"/>
<GridViewColumn Header="ProjectId" Width="0" DisplayMemberBinding="{Binding ProjectId}" />
</GridView>
</ListView.View>
</ListView>
And here I show you a Checkbox witch works perfectly
<CheckBox x:Name="CbxCategoryActiveActive" Content="Inaktiv:" Grid.Row="4" Grid.Column="1" Margin="0 0 168 0" VerticalAlignment="Center"
HorizontalContentAlignment="Left" Grid.ColumnSpan="2"
IsChecked="{Binding ElementName=LivCategories, Path = SelectedValue.CategoryIsObsolete, Mode = TwoWay}" />
One of the ways I have tried for the ComboBox you can see here
<ComboBox x:Name="CbxProject" Text="Projekt" Grid.Row="5" Grid.Column="2" HorizontalContentAlignment="Left" VerticalContentAlignment="Center"
ItemsSource="{Binding Path=Projects_GetActive}" DisplayMemberPath="ProjectName"
SelectedValuePath="LivCategories"
SelectedItem="{Binding ElementName=LivCategories, Path= SelectedValue.ProjectName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsSynchronizedWithCurrentItem="True">
</ComboBox>
And here You can see the SelectedCategory
private Category _selectedCategory;
public MyICommand DeleteCommand { get; set; }
public Category SelectedCategory
{
get
{
return _selectedCategory;
}
set
{
_selectedCategory = value;
DeleteCommand.RaiseCanExecuteChanged();
}
}

