首页 > 解决方案 > XamDataGrid 中的 XamComboBoxField 为空

问题描述

请帮助xamdatagrid的组合框字段的下拉列表中没有数据,这唯一表明它是一个集合 在此处输入图像描述

我有这门课

 public class AvisTIlGrid {
        public int BureaoOrdreNr { get; set; }
        public decimal Total { get; set; }
        public int UgeavisID { get; set; }
        public string bureauOrdreNr { get; set; }

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

}
public  class Fejl
    {
        private string fejltekst;

        public string FejlTekst { get => fejltekst; set => fejltekst = value; }
    }

在 Dao 类中,fejl 填充了来自 FejlTekstTable 的数据

fejl = diMPdot.tblFejlTeksts.Select( f => new Fejl()
                                               {
                                                   FejlTekst = f.FejlTekst
                                               }).ToList()

查询的结果如下所示,它是 List Ingen valgt Bestilt for sent - ikke bragt Ordre ikke modtaget Glemt annonce DLU har fremsendt forkert matr。Vi har indrykket forkert matr。Forkert farve Forkert 放置 Forkert annonce 格式 Glemt farve

在我的视图类中,我有一个 XamDataGrid,其中指定了一个 ComboBoxField,但是当我运行代码时,下拉菜单中没有数据

      <igWPF:ComboBoxField  Name="fejl" DisplayMemberPath="FejlTekst" Label="Fejl" >
                    </igWPF:ComboBoxField>

标签: c#wpfxamdatagrid

解决方案


 <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}"/>
                                </Style>
                            </igWPF:FieldSettings.EditorStyle>
                        </igWPF:FieldSettings>
                    </igWPF:ComboBoxField.Settings>
                    </igWPF:ComboBoxField>

推荐阅读