WPF - 不同GridViewColumns中的不同SelectedValues?

时间:2015-09-10 06:07:29

标签: wpf gridview binding key-value

我有12个属性,我想将它们中的每一个绑定到ListView中的一个GridViewColumn。它们包含ID(字符串),如下所示:

            1<<TXE  = 00001000 = 0x08
            1<<RXE  = 00010000 = 0x10
(1<<RXE) | (1<<TXE) = 00011000 - 0x18

我的数据库中还有一个Key-Table,其中包含一个密钥和一个描述,我已经在我的Code-Behind中了:

        //DAR01
        public static readonly PropertyInfo<string> DAR01Property = RegisterProperty<string>(p => p.DAR01);
        /// <summary>
        ///Date type
        /// </summary>
        public string DAR01 
        {
            get { return GetProperty( DAR01Property); }
            set { SetProperty(DAR01Property, value); }
        }

基本上解释我想要的最简单的方法是以下ComboBox,但是在GridView中有多个具有不同Bindings的GridViewColumns:

public System.Collections.Generic.IEnumerable<AOK.NW.Beihilfe.Customizing.Schluessel> PlanungsdatenSchluessel
        {
            get
            {
                System.Collections.Generic.IEnumerable<AOK.NW.Beihilfe.Customizing.Schluessel> SchluessellistePlanungsdaten = Schluesselliste.GetSchluesselliste().Where<Schluessel>(x => x.Gruppe == "T548T");
                return SchluessellistePlanungsdaten;
            }
        }

我的GridViewColumns(上升到DAR12):

<ComboBox Grid.Row="2" Grid.Column="1" Width="Auto"
                      ItemsSource="{Binding Path=PlanungsdatenSchluessel}"
                      DisplayMemberPath="Beschreibung"
                      SelectedValuePath="Id"
                      SelectedValue="{Binding Path=CurrentDate.DAR01}"
                      IsEnabled="{Binding Path=IsBearbeiten}"/>

<ComboBox Grid.Row="3" Grid.Column="1" Width="Auto"
                  ItemsSource="{Binding Path=PlanungsdatenSchluessel}"
                  DisplayMemberPath="Beschreibung"
                  SelectedValuePath="Id"
                  SelectedValue="{Binding Path=CurrentDate.DAR02}"
                  IsEnabled="{Binding Path=IsBearbeiten}"/>

[...]

我是如何实现这一目标的?我很感激任何小费!

0 个答案:

没有答案