2017-09-14 2 views
0
내가 텍스트 상자, 콤보 상자 또는 슬라이더 중 하나로서 다른 편집 가능한 값을 표시하는 DataTemplateSelector를 사용하는 데이터 그리드를 가지고

와 편집 세포. 문제는이 셀에 탭할 수 있지만 키보드로 편집 할 방법이 없다는 것입니다. 셀이 집중되면 내부에서 항목을 편집 할 수있을 것이라고 상상했습니다.Xceed DataGrid의 : 키보드 탐색

예 : 탭은 텍스트 상자 - 셀> 입력 예를 시작 탭을 슬라이더 - 셀> 이제 초점을 맞추고 있습니다> 화살표 키를 사용하여이

을 편집하는 것이 내가 편집을 시작하는 마우스로 클릭해야 지금처럼 . 키보드 만 사용하여 편집을 시작할 수는 없습니다. 어떤 도움에 감사드립니다

<UserControl.Resources> 

    <!--#region DataTemplateSelector--> 
    <local:SettingsDataTemplateSelector x:Key="SettingsDataTemplateSelector" /> 

    <DataTemplate x:Key="TextboxDataTemplate"> 
     <xcdg:MaskedTextBox IsTabStop="True" Mask="{Binding EditMask}" Text="{Binding EditValue, IsAsync=False, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnExceptions=True}"/> 
    </DataTemplate> 

    <DataTemplate x:Key="ComboDataTemplate"> 
     <ComboBox IsTabStop="True" ItemsSource="{Binding Path=SelectionValues}" 
            SelectedValuePath="Value" 
            SelectedValue="{Binding Path=SelectionValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
            DisplayMemberPath="ValueText"> 
     </ComboBox> 
    </DataTemplate> 

    <DataTemplate x:Key="SliderDataTemplate"> 
     <Slider IsTabStop="True" Value="{Binding EditSliderValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
        Minimum="{Binding MinRangeValue}" 
        Maximum="{Binding MaxRangeValue}" 
        VerticalAlignment="Bottom" 
        IsSnapToTickEnabled="True" 
        TickFrequency="1" 
        Margin="0,0,0,0"/> 
    </DataTemplate> 
    <!--#endregion--> 

    <xcdg:DataGridCollectionViewSource x:Key="Features" 
             Source ="{Binding Path=Demo.Features}" 
             AutoFilterMode="And" 
             AutoCreateDetailDescriptions="False" 
             AutoCreateItemProperties="False"> 
     <xcdg:DataGridCollectionViewSource.DetailDescriptions> 
      <xcdg:PropertyDetailDescription RelationName="Settings" AutoCreateDetailDescriptions="False" AutoCreateItemProperties="False"/> 
     </xcdg:DataGridCollectionViewSource.DetailDescriptions> 
    </xcdg:DataGridCollectionViewSource> 
</UserControl.Resources> 

<Grid> 
    <!--#region Xceed DataGrid--> 
    <xcdg:DataGridControl x:Name="datagrid" 
          ItemsSource="{Binding Source={StaticResource Features}}" 
          KeyUp="DatagridKeyUp" 
          AllowDetailToggle="True" 
          Margin="10" 
          NavigationBehavior="RowOrCell" 
          CellEditorDisplayConditions="RowIsBeingEdited, 
          MouseOverCell, MouseOverRow, RowIsCurrent, CellIsCurrent" 
          EditTriggers="BeginEditCommand, ClickOnCurrentCell, 
          SingleClick, CellIsCurrent, ActivationGesture, RowIsCurrent" 
          ItemScrollingBehavior="Immediate" 
          AutoCreateColumns="False"> 

     <xcdg:DataGridControl.Resources> 
      <Style TargetType="xcdg:TableViewScrollViewer"> 
       <Setter Property="HorizontalScrollBarVisibility" Value="Auto" /> 
       <Setter Property="VerticalScrollBarVisibility" Value="Auto" /> 
      </Style> 
     </xcdg:DataGridControl.Resources> 

     <xcdg:DataGridControl.View> 
      <xcdg:TableflowView UseDefaultHeadersFooters="False" ColumnStretchMode="Last"> 
       <xcdg:TableflowView.FixedHeaders> 
        <DataTemplate> 
         <xcdg:ColumnManagerRow /> 
        </DataTemplate> 
       </xcdg:TableflowView.FixedHeaders> 
      </xcdg:TableflowView> 
     </xcdg:DataGridControl.View> 

     <xcdg:DataGridControl.Columns> 
      <xcdg:Column FieldName="FeatureID" Title="FeatureID" ReadOnly="True" /> 
      <xcdg:Column FieldName="Name" Title="Feature name" ReadOnly="True" /> 
      <xcdg:Column FieldName="Description" Title="Description" ReadOnly="True" /> 
      <xcdg:Column FieldName=" "/> 
     </xcdg:DataGridControl.Columns> 

     <xcdg:DataGridControl.DetailConfigurations> 
      <xcdg:DetailConfiguration RelationName="Settings" Title=""> 
       <xcdg:DetailConfiguration.Columns> 
        <xcdg:Column FieldName="Name" Title="Name" ReadOnly="True"/> 
        <xcdg:Column FieldName="Description" Title="Description" ReadOnly="True"/> 
        <xcdg:Column FieldName="EditValues" Title="Edit Values" ReadOnly="True"/> 
        <xcdg:Column FieldName="EditValueVar" Title="Edit Value" Width="150" ReadOnly="False" 
           CellContentTemplateSelector="{StaticResource SettingsDataTemplateSelector}" 
           DisplayMemberBinding="{Binding}" /> 
        <xcdg:Column FieldName=" "/> 
       </xcdg:DetailConfiguration.Columns> 
      </xcdg:DetailConfiguration> 
     </xcdg:DataGridControl.DetailConfigurations> 
    </xcdg:DataGridControl> 
    <!--#endregion--> 
</Grid> 

:

여기 내 코드입니다.

답변

0

나는 Xceed의 CellEditors을 사용하여 끝났다. 키보드를 사용하여 편집하려면 주위를 둘러 볼 방법이없는 것 같습니다.

변경 EditValueVar의 이것에 열 :

    <xcdg:Column FieldName="EditValueVar" Title="Edit Value" Width="150" ReadOnly="False" 
          CellEditorSelector="{StaticResource SettingsCellEditorSelector}"/> 

참고 :

<xcdg:CellEditor x:Key="maskEditor"> 
    <xcdg:CellEditor.EditTemplate> 
     <DataTemplate> 
      <xcdg:MaskedTextBox Mask="{Binding EditMask}" 
           Text="{Binding Path=(xcdg:Cell.ParentCell).DataContext.EditValue, 
               RelativeSource={RelativeSource Self}, 
               IsAsync=False, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnExceptions=True}" 
           Style="{StaticResource {x:Type xcdg:MaskedTextBox}}"/> 
      <!--Text="{Binding EditValueText, IsAsync=False, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnExceptions=True}"/>--> 
     </DataTemplate> 
    </xcdg:CellEditor.EditTemplate> 
    <xcdg:CellEditor.ActivationGestures> 
     <xcdg:TextInputActivationGesture /> 
    </xcdg:CellEditor.ActivationGestures> 
</xcdg:CellEditor> 

<xcdg:CellEditor x:Key="comboEditor"> 
    <xcdg:CellEditor.EditTemplate> 
     <DataTemplate> 
      <ComboBox ItemsSource="{Binding Path=(xcdg:Cell.ParentCell).DataContext.SelectionValues, 
              RelativeSource={RelativeSource Self}, UpdateSourceTrigger=PropertyChanged}" 
         SelectedValuePath="Value" 
         SelectedValue="{Binding Path=(xcdg:Cell.ParentCell).DataContext.SelectionValue, 
               RelativeSource={RelativeSource Self}, 
               UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" 
         DisplayMemberPath="ValueText" 
         Style="{StaticResource {x:Type ComboBox}}" 
         ItemContainerStyle="{StaticResource {x:Type ComboBoxItem}}"/> 
     </DataTemplate> 
    </xcdg:CellEditor.EditTemplate> 
    <xcdg:CellEditor.ActivationGestures> 
     <xcdg:KeyActivationGesture SystemKey="Down" 
            Modifiers="Alt" /> 
     <xcdg:KeyActivationGesture Key="Up" 
            Modifiers="Alt" /> 
     <xcdg:KeyActivationGesture Key="F4" /> 
     <xcdg:KeyActivationGesture Key="Space" /> 
    </xcdg:CellEditor.ActivationGestures> 
</xcdg:CellEditor> 

<xcdg:CellEditor x:Key="sliderEditor"> 
    <xcdg:CellEditor.EditTemplate> 
     <DataTemplate> 
      <Slider Value="{Binding Path=(xcdg:Cell.ParentCell).DataContext.EditSliderValue, 
          RelativeSource={RelativeSource Self}, 
          Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
        Minimum="{Binding Path=(xcdg:Cell.ParentCell).DataContext.MinRangeValue, RelativeSource={RelativeSource Self}}" 
        Maximum="{Binding Path=(xcdg:Cell.ParentCell).DataContext.MaxRangeValue, RelativeSource={RelativeSource Self}}" 
        Style="{StaticResource {x:Type Slider}}" 
        VerticalAlignment="Bottom" 
        IsSnapToTickEnabled="True" 
        TickFrequency="1" 
        Margin="0,0,0,0"/> 
     </DataTemplate> 
    </xcdg:CellEditor.EditTemplate> 
    <xcdg:CellEditor.ActivationGestures> 
     <xcdg:KeyActivationGesture SystemKey="Right" 
           Modifiers="Alt" /> 
     <xcdg:KeyActivationGesture Key="Left" 
           Modifiers="Alt" /> 
     <xcdg:KeyActivationGesture Key="F4" /> 
     <xcdg:KeyActivationGesture Key="Space" /> 
    </xcdg:CellEditor.ActivationGestures> 
</xcdg:CellEditor> 
: 그것은 여기에 동적 데이터

문제를 일으킬 수 있으므로 제거 된 DisplayMemberBinding 내가 지금 사용하는 CellEditors 있습니다

당신은 계속 이상한 (xcdg:Cell.ParentCell) -stuff을 알 수 있습니다 그리고 예, 그것은 죄와 같은 추한, 그러나 이것은 르입니다 그것을하는 git 방법. 당신은 대신 xcdg:CellEditorBinding를 사용하여 더 좋은 행운이있을 수 있습니다. {Binding Path=(xcdg:Cell.ParentCell).Content, Mode=TwoWays, RelativeSource={RelativeSource Self}, UpdateSourceTrigger=PropertyChanged}을 :

xcdg:CellEditorBinding 이렇게 결합 등가이다.

내 데이터가 구조화되어 있기 때문에 내용 앞에 .DataContext을 추가했습니다.

는 희망이 누군가를하는 데 도움이!