I am developing a WPF application using MVVM pattern. I have a combo in the view and two lists in the viewmodel (projects and organizations). Depending on the organizations list items I have to bind the the name of the organization or not. For example if the Count property of the organizations list is 1 the combobox item have to be "ProjectName", and if the Count property of the organizations list is greater than 1 the combobox item should look like "ProjectName - OrganizationName". This is the XAML code I have:
<ComboBox x:Name="textBox3" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" ItemsSource="{Binding Path=Projects}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding Path=SelectedProject}">
</ComboBox>
How should I achieve this purpose. I hope for a little help. Cheers.
Aucun commentaire:
Enregistrer un commentaire