WPF-不同GridViewColumns中的不同SelectedValue?
我有12个属性,我想将它们分别绑定到ListView中的一个GridViewColumn。它们包含一个ID(字符串),如下所示:WPF-不同GridViewColumns中的不同SelectedValue?,wpf,gridview,binding,key-value,Wpf,Gridview,Binding,Key Value,我有12个属性,我想将它们分别绑定到ListView中的一个GridViewColumn。它们包含一个ID(字符串),如下所示: //DAR01 public static readonly PropertyInfo<string> DAR01Property = RegisterProperty<string>(p => p.DAR01); /// <summary> ///Date ty
//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); }
}
//DAR01
公共静态只读属性info DAR01Property=RegisterProperty(p=>p.DAR01);
///
///日期类型
///
公共字符串DAR01
{
获取{return GetProperty(DAR01Property);}
集合{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;
}
}
public System.Collections.Generic.IEnumerable Planungsdatenschluesel
{
收到
{
System.Collections.Generic.IEnumerable SchluessellistePlanungsdaten=Schluesselliste.GetSchluesselliste()。其中(x=>x.Gruppe==“T548T”);
返回SchluessellistePlanungsdaten;
}
}
基本上,解释我想要什么的最简单方法是以下组合框,但在具有多个具有不同绑定的GridViewColumns的GridView中:
<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):
有什么办法可以做到吗?谢谢你给我的小费 您面临的确切问题是什么?我在问题中添加了我的GridViewColumns。我想将属性(DAR01等)绑定到GridViewColumns,但显示键表中的描述(PlanungsdatenSchluessel.Description)。键表具有与属性相同的ID。您没有GridViewComboxColumn吗?没有。如果我有它,我可以禁用组合框,但这不是我的目标。我只是想用GridViewColumn来做。CellTemplate呢?
<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>