質問

I have a RadDatagrid which is dynamically populated with input boxes. Each datatype has it's own DataTemplate. Now when I type in a text input and press enter it select will open a text box on the next cell. If that is a cell which has a dropdown list and I start typing it will start writing a string value in the cell. I guess the mechanism works for normal input boxes, as the typed value is just copied into the control. But for a dropdown list it causes an error, as you can't enter a string into a list.

When selecting the control with the mouse everything works fine. This only happens with keyboard selecting. I think the difference is that the control gets selected instead of the grid cell.

Here is the XAML for the template:

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

I'm thinking to use the cell changed event to programmaticaly select the control, but I can't seem to find a way to select it. How can i stop it from getting into the cell edit mode?

役に立ちましたか?

解決

I got the answer from Telerik. The solution is to set the whole column to read only and replace any TextBlock field with a TextBox. The read only doesn't disable the controls in the column, only the fields themselves, so it's no longer possible to enter editing mode in the fields under the controls.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top