【问题标题】:Selecting dropdown list in a RadDataGrid在 RadDataGrid 中选择下拉列表
【发布时间】:2014-02-21 11:53:48
【问题描述】:

我有一个用输入框动态填充的 RadDatagrid。每种数据类型都有自己的 DataTemplate。现在,当我输入文本输入并按 Enter 时,选择将在下一个单元格上打开一个文本框。如果那是一个有下拉列表的单元格并且我开始输入它将开始在单元格中写入一个字符串值。我猜该机制适用于普通输入框,因为键入的值只是复制到控件中。但对于下拉列表,它会导致错误,因为您无法将字符串输入到列表中。

当用鼠标选择控件时,一切正常。这仅在键盘选择时发生。我认为不同之处在于控件被选中而不是网格单元格。

这是模板的 XAML:

<local:SettingValueTemplateSelector.DictionaryTemplate>
   <DataTemplate>
      <telerik:RadComboBox   
          SelectedValuePath="Key" 
          DisplayMemberPath="Value" 
          SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}" 
          IsEnabled="{Binding IsWritable}">
      <telerik:RadComboBox.ItemsSource>
      <MultiBinding Converter="{StaticResource InputTypeConverter}"  ConverterParameter="dictionary">
          <Binding Path="SettingsValue" Mode="TwoWay"/>
          <Binding Path="Type" Mode="OneWay"/>
      </MultiBinding>
       </telerik:RadComboBox.ItemsSource>
    </telerik:RadComboBox>
    </DataTemplate>
</local:SettingValueTemplateSelector.DictionaryTemplate>

我正在考虑使用单元格更改事件以编程方式选择控件,但我似乎找不到选择它的方法。如何阻止它进入单元格编辑模式?

【问题讨论】:

    标签: c# wpf telerik telerik-grid


    【解决方案1】:

    我从 Telerik 那里得到了答案。解决方案是将整列设置为只读,并将任何 TextBlock 字段替换为 TextBox。只读不会禁用列中的控件,只会禁用字段本身,因此不再可能在控件下的字段中进入编辑模式。

    【讨论】:

      猜你喜欢
      • 2017-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多