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
3160
XamComboBox Valuepath
posted

I am trying to bind to an observablecollection of string. 

When I do not set the valuepath property of the xamcomboeditor it does not display an initial value even though I set an initial value in the init method of my datagrid and the initial value is one of the items in the combobox.

If I set the valuepath property to "Value", the xamcomboeditor dissplays an initial value however it is not the value I set in the init method.  Also, the value is not bound to the dataitem (dataitem value is always null).

I tried changing the observable collection to a dictionary of string, string based on this post: http://community.infragistics.com/forums/t/54920.aspx. and again the initial value of the combo box is not displayed.
Here is the XAML:

<igDP:Field Name="CLASS" Label="Class">
 <igDP:Field.Settings>
  <igDP:FieldSettings>
   <igDP:FieldSettings.EditorStyle>
    <Style TargetType="{x:Type igEditors:XamComboEditor}">
     <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RuleClasses}"></Setter>
     <Setter Property="ValuePath" Value=""></Setter>
     <Setter Property="DisplayMemberPath" Value=""></Setter>
     <Setter Property="Value" Value="{Binding DataItem.CLASS, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></Setter>
    </Style>
   </igDP:FieldSettings.EditorStyle>
  </igDP:FieldSettings>
 </igDP:Field.Settings>
</igDP:Field>         
         
I set the initial values for a new row in the init evennt of the datagrid:

private void InitRule(object sender, InitializeTemplateAddRecordEventArgs e)
{
 e.TemplateAddRecord.SetCellValue(e.TemplateAddRecord.FieldLayout.Fields["CLASS"], TBARule.Classes.Roll );
 e.TemplateAddRecord.SetCellValue(e.TemplateAddRecord.FieldLayout.Fields["TYPE"], TBARule.Types.ACE);
 e.TemplateAddRecord.SetCellValue(e.TemplateAddRecord.FieldLayout.Fields["ALLOW_IND"], "Y");
}
  
  
How can I fix this please?  I would prefer to use an observablecollection or list if possible.

Thanks,

Sam

  • 138253
    Offline posted

    Hello Sam,

     

    I am just checking if you got this worked out or you still require any assistance or clarification on the matter.

  • 138253
    Offline posted

    Hello Sam,

     

    Thank you for your post. I have been looking into it and I can say that you should set the XamComboEditor’s DisplayMemberPath to the Property which value you want to be shown in the DropDown and the ValuePath the property which value you want to be assigned the editor’s Value. Please let me know if this helps you or you need further clarifications on this matter.

     

    Looking forward for your reply.