English 中文(简体)
WPF DataGrid - Problemtomizing a ComboBox
原标题:WPF DataGrid - Problem Customizing a ComboBox
  • 时间:2009-10-06 16:33:32
  •  标签:

我有一个数据网,有一只 com子盒子。

<tk:DataGridComboBoxColumn SelectedValueBinding="{Binding DefaultLocationID}"                                            
    SelectedValuePath="LocationID"
    DisplayMemberPath="LocationName"    
    Header="Default Location"
    ItemsSource="{Binding Source={StaticResource CustomerLocations}}">
</tk:DataGridComboBoxColumn>

归根结底,我要根据具体情况,把注意力放下,以显示身份和共同点名,这样一来似乎就是路要走。 从小开始,我可以举出以下简单的例子来替代标准数据GridComboBoxColumn。 下降似乎是罚款,但当我选择一个下降的项目时,它不接受并回到原来的价值。 我在Modest=TwoWay上尝试了改动,但无uck。 我是否需要一个小组。

违约 ID是正在编辑的外国钥匙领域,而定位信息数据库是客户分布的一个栏目。

<tk:DataGridTemplateColumn  Header="Default Location">
    <tk:DataGridTemplateColumn.CellTemplate>
       <DataTemplate>
            <ComboBox   VerticalAlignment="Top"   
                  SelectedItem="{Binding LocationID, Mode=TwoWay}" 
                  SelectedValue="{Binding DefaultLocationID, Mode=TwoWay}"  

                  ItemsSource="{Binding Source={StaticResource CustomerLocations}}"
                        SelectedValuePath="LocationID"
                        DisplayMemberPath="LocationName" >
              </ComboBox>
       </DataTemplate>
  </tk:DataGridTemplateColumn.CellTemplate>

感谢!

问题回答

您能否把客户占用资源的相关部分放在桌面上? 您的电网对哪类电网具有约束力?

Trymoving the SelectedValuePath, show MembersPath and Selected Selected ComboBox的数值。

如果你想在 com子中展示多种数据,请见以下XAML。

<ComboBox ...>
    <ComboBox.ItemTemplate>
        <DataTemplate>
             <StackPanel Orientation="Horizontal">
                  <TextBlock Text="{Binding LocationId}"} />
                  <TextBlock Text=" - "/>
                  <TextBlock Text="{Binding LocationName}"} />
             </StackPanel>
       </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>




相关问题
热门标签