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
1715
Binding to a complex property and editing it using XamComboEditor
posted

One of my properties is of a type called Country. The country has a ShortName : String and Name : String. My XamComboBox contains items of type ComboBoxDataItem with value of type Country and display path of type String (corresponding to a country's  Name). The idea is that I will select a Name from the drop down, and the proper Country will be set. However, I'm finding this quite difficult to do. My XAML looks like the following:

          <igDP:UnboundField Name="Country" Label="Country" BindingPath="Country.Name" BindingMode="TwoWay">
              <igDP:Field.Settings>
                <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" 
                                    AllowEdit="True" >
                  <igDP:FieldSettings.EditorStyle>
                    <Style TargetType="{x:Type igEditors:XamComboEditor}">
                      <Setter Property="ItemsProvider" Value="{StaticResource countriesP}" />
                    </Style>
                  </igDP:FieldSettings.EditorStyle>
                </igDP:FieldSettings>
              </igDP:Field.Settings>
            </igDP:UnboundField>

I'm displaying the country's name, which is all good. But I'd like to modify the Country property of my main Data Item. The XAML above certainly won't work, since the Binding will try to assign the Country object to country name. 

How do I do this? One way, which is nasty, it to have some kind of property of my DataItem that can be set and will easily assign the proper Country object to it, but is there a clearned way to view/edit complex properties?

 

Thanks,

-Szymon