WPF - разные SelectedValues ​​в разных GridViewColumns?

У меня есть 12 свойств, и я хочу связать каждое из них с одним GridViewColumn в ListView. Они содержат идентификатор (строку) и выглядят следующим образом:

        //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); }
        }

У меня также есть таблица ключей в моей базе данных, которая содержит ключ и описание, которое у меня уже есть в моем коде:

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;
            }
        }

В основном, самый простой способ объяснить, что я хочу, это следующие ComboBox, но в GridView с несколькими столбцами GridViewColumns, которые имеют разные привязки:

<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}"/>

[...]

Мой GridViewColumns (идет до DAR12):

<ListView Grid.Row="0"
                  ItemsSource="{Binding Path=Person.Planungsdaten}"
                  IsSynchronizedWithCurrentItem="True"
                  SelectedItem="{Binding SelectedItem}"
                  MaxHeight="580" Height="Auto"
                  Width="Auto"
                  ScrollViewer.CanContentScroll="True" 
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  ScrollViewer.HorizontalScrollBarVisibility="Auto">

<GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=DAR01}">
                                <GridViewColumnHeader Name="DAR01" Content="Datentyp 01"/>
                            </GridViewColumn>

    <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=DAR02}">
                            <GridViewColumnHeader Name="DAR02" Content="Datentyp 02"/>
                        </GridViewColumn>

</GridView>
            </ListView.View>
        </ListView>

Есть идеи, как мне этого добиться? Я благодарен за любой совет!

0 ответов

Другие вопросы по тегам