Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Binding ComboBoxColumn Itemssource to a alit in ViewModel with RelativeSource
posted

I want bind a list in my viewModel to itemssource of ComboBoxColumn but my code does not work.

but if i use a templatecolumn and in its edittemplate place a combobox, my syntax for itemssource worked

how can i solve my problem?

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ig="http://schemas.infragistics.com/xaml"
xmlns:wpfApplication28="clr-namespace:WpfApplication28"
x:Class="WpfApplication28.MainWindow"
Title="MainWindow" Height="350" Width="525">
           <Window.DataContext>
                <wpfApplication28:ViewModel />
           </Window.DataContext>
           <Grid>
                      <ig:XamGrid AutoGenerateColumns="False"
                        ItemsSource="{Binding Path=Products}">
                                <ig:XamGrid.EditingSettings>
                                           <ig:EditingSettings AllowEditing="Row"/>
                                 </ig:XamGrid.EditingSettings>
                                  <ig:XamGrid.Columns>
                                          <ig:TextColumn HeaderText="Name" Key="Name" Width="200" />
                                          <ig:ComboBoxColumn ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window},
                                               Path=DataContext.Cities}" Key="City" DisplayMemberPath="Name"/>
                                   </ig:XamGrid.Columns>
                </ig:XamGrid>
             </Grid>
</Window>