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
460
Set Default value in XamComboField in XamDataGrid
posted

I have this igWPF:ComboBoxField   and I would  like to set a default value. 

the 

class looks like this that loads in grid 

public class AvisTIlGrid
{

public List<Fejl> fejl { get; set; }

}

public class Fejl
{
public string FejlTekst { get; set; }
public byte FejlKode { get; internal set; }
}

<igWPF:ComboBoxField Name="fejl" Label="Fejl" DisplayMemberPath="FejlTekst" ValuePath="FejlTekst" BindingType="Unbound" Visibility="Collapsed">
<igWPF:ComboBoxField.Settings>
<igWPF:FieldSettings>
<igWPF:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igWPF:XamComboEditor}">
<Setter Property="ItemsSource" Value="{Binding DataItem.fejl}"/>
<Setter Property="DisplayMemberPath" Value="FejlTekst"/>
<Setter Property="ValuePath" Value="{Binding DataItem.fejl}"/>

</Style>
</igWPF:FieldSettings.EditorStyle>
</igWPF:FieldSettings>
</igWPF:ComboBoxField.Settings>
</igWPF:ComboBoxField>

  • 34810
    Offline posted

    Hello Thomas,

    I am under the impression in this case that the List<Fejl> is the collection that you have bound to the grid as well as the collection that you are trying to bind to the XamComboEditor within your ComboBoxField. If this is the case, I would highly recommend against this because changing the value of your XamComboEditor would change the value of other rows as well.

    The XamComboEditor within a ComboBoxField will take the value of the Field as its default value as long as that value exists within the XamComboEditor’s ItemsSource, and for reference, I am attaching a sample project to demonstrate how this can be configured.

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.

    XDGComboFieldDemo.zip