精华内容
下载资源
问答
  • xceed.wpf.datagrid
    2014-07-12 12:33:00
    <!--***********************************************************************************
    
       Extended WPF Toolkit
    
       Copyright (C) 2007-2013 Xceed Software Inc.
    
       This program is provided to you under the terms of the Microsoft Public
       License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 
    
       For more features, controls, and fast professional support,
       pick up the Plus Edition at http://xceed.com/wpf_toolkit
    
       Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
    
      **********************************************************************************-->
    
    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:local="clr-namespace:Xceed.Wpf.DataGrid"
                        xmlns:markup="clr-namespace:Xceed.Wpf.DataGrid.Markup"
                        xmlns:conv="clr-namespace:Xceed.Wpf.DataGrid.Converters"
                        xmlns:views="clr-namespace:Xceed.Wpf.DataGrid.Views">
    
       <ResourceDictionary.MergedDictionaries>
          <ResourceDictionary Source="Common.Resources.xaml" />
       </ResourceDictionary.MergedDictionaries>
    
       <Style x:Key="tableflowViewRowFocusVisualStyle"
              TargetType="IFrameworkInputElement">
          <Style.Resources>
             <conv:ThicknessConverter x:Key="thicknessConverter" />
          </Style.Resources>
    
          <Setter Property="Control.Template">
             <Setter.Value>
                <ControlTemplate>
                   <Rectangle Stroke="#FF000000"
                              StrokeThickness="1"
                              StrokeDashArray="1 2"
                              Margin="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollViewer}}, Path=HorizontalOffset, Converter={StaticResource thicknessConverter}, ConverterParameter='Left'}"
                              SnapsToDevicePixels="True" />
                </ControlTemplate>
             </Setter.Value>
          </Setter>
       </Style>
    
       <conv:ThicknessConverter x:Key="inverseThicknessConverter"
                                InverseValue="True" />
    
       <!--**************************
        * TEMPLATE: DataGridControl 
        ************************** -->
       <ControlTemplate x:Key="tableflowViewDataGridControlTemplate"
                        TargetType="local:DataGridControl">
          <Grid>
             <Border Background="{TemplateBinding Background}"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{TemplateBinding BorderThickness}">
    
                <!-- The AdornerDecorator will allow visual cues for Drag & Drop operations. -->
                <AdornerDecorator x:Name="PART_DragDropAdornerDecorator">
                   <!-- The TableViewScrollViewer takes care of laying out the various sections of
                           a DataGrid in TableflowView: FixedHeaders, FixedFooters, RowSelectorPane, etc. -->
                   <views:TableViewScrollViewer x:Name="PART_ScrollViewer"
                                                ShowRowSelectorPane="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ShowRowSelectorPane}"
                                                RowSelectorPaneWidth="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).RowSelectorPaneWidth}"
                                                Padding="{TemplateBinding Padding}">
    
                      <views:TableflowViewItemsHost />
    
                   </views:TableViewScrollViewer>
                </AdornerDecorator>
             </Border>
             <Grid x:Name="connectionStateGrid"
                   HorizontalAlignment="Right"
                   VerticalAlignment="Bottom"
                   Margin="0,0,25,25"
                   Height="30"
                   Width="30">
                <ContentPresenter x:Name="connectionStateLoadingContentPresenter"
                                  ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ConnectionStateLoadingGlyph}"
                                  Content="{TemplateBinding ConnectionState}"
                                  Visibility="Collapsed" />
                <ContentPresenter x:Name="connectionStateCommittingContentPresenter"
                                  ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ConnectionStateCommittingGlyph}"
                                  Content="{TemplateBinding ConnectionState}"
                                  Visibility="Collapsed" />
                <ContentPresenter x:Name="connectionStateErrorContentPresenter"
                                  ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ConnectionStateErrorGlyph}"
                                  Content="{TemplateBinding ConnectionState}"
                                  Visibility="Collapsed" />
             </Grid>
          </Grid>
          <ControlTemplate.Triggers>
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).IsConnectionStateGlyphEnabled}"
                          Value="False">
                <Setter TargetName="connectionStateGrid"
                        Property="Visibility"
                        Value="Collapsed" />
             </DataTrigger>
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DataGridControl.ConnectionState}"
                          Value="Loading">
                <Setter TargetName="connectionStateLoadingContentPresenter"
                        Property="Visibility"
                        Value="Visible" />
                <Setter TargetName="connectionStateErrorContentPresenter"
                        Property="Visibility"
                        Value="Collapsed" />
                <Setter TargetName="connectionStateCommittingContentPresenter"
                        Property="Visibility"
                        Value="Collapsed" />
             </DataTrigger>
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DataGridControl.ConnectionState}"
                          Value="Committing">
                <Setter TargetName="connectionStateLoadingContentPresenter"
                        Property="Visibility"
                        Value="Collapsed" />
                <Setter TargetName="connectionStateErrorContentPresenter"
                        Property="Visibility"
                        Value="Collapsed" />
                <Setter TargetName="connectionStateCommittingContentPresenter"
                        Property="Visibility"
                        Value="Visible" />
             </DataTrigger>
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DataGridControl.ConnectionState}"
                          Value="Error">
                <Setter TargetName="connectionStateLoadingContentPresenter"
                        Property="Visibility"
                        Value="Collapsed" />
                <Setter TargetName="connectionStateErrorContentPresenter"
                        Property="Visibility"
                        Value="Visible" />
                <Setter TargetName="connectionStateCommittingContentPresenter"
                        Property="Visibility"
                        Value="Collapsed" />
             </DataTrigger>
    
          </ControlTemplate.Triggers>
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: RowSelector 
        ************************** -->
       <ControlTemplate x:Key="tableflowViewRowSelectorTemplate"
                        TargetType="local:RowSelector">
    
          <!-- This Grid is used to position the resizer Thumb over the RowSelector -->
          <Grid>
    
             <Border Background="{TemplateBinding Background}"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{TemplateBinding BorderThickness}"
                     Padding="{TemplateBinding Padding}">
    
                <ContentPresenter x:Name="contentPresenter"
                                  Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
             </Border>
    
             <!-- Thumb that is used to resize the Row. -->
             <Thumb x:Name="PART_RowResizerThumb"
                    Style="{StaticResource invisibleThumbStyle}"
                    VerticalAlignment="Bottom" />
    
          </Grid>
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: Row 
        ************************** -->
       <ControlTemplate x:Key="tableflowViewRowTemplate"
                        TargetType="local:Row">
    
          <!-- A basic Row Template requires at least a Panel named "PART_CellsHost" to which the Row's cells will be added.
               This Panel is usually placed inside a Border who is responsible for painting the gridlines. -->
          <ControlTemplate.Resources>
             <conv:TypeToBooleanConverter x:Key="typeToBooleanConverter" />
          </ControlTemplate.Resources>
    
          <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the CellsHost panel. -->
          <Grid x:Name="rootGrid">
             <Grid.ColumnDefinitions>
                <!-- HierarchicalGroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
                <!-- GroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
                <!-- MasterDetail ToggleButton -->
                <ColumnDefinition Width="Auto" />
    
                <!-- CellsHost panel -->
                <ColumnDefinition Width="*" />
             </Grid.ColumnDefinitions>
    
             <!-- The border responsible for the visual outline of the row (gridlines and background)
                           spans the GroupLevelIndicatorPane and CellsHost Panel. Those 2 elements are not children of
                           the Border because we don't want the border to be displayed in the GroupLevelIndicatorPane. -->
             <Border x:Name="rootBorder"
                     Grid.Column="2"
                     Grid.ColumnSpan="2"
                     views:TableView.CanScrollHorizontally="False"
                     Background="{TemplateBinding Background}"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{TemplateBinding BorderThickness}"
                     Padding="{TemplateBinding Padding}" />
    
             <local:HierarchicalGroupLevelIndicatorPane Grid.Column="0"
                                                        views:TableView.CanScrollHorizontally="False" />
    
             <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                           whenever this Row is part of a group. -->
             <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                            views:TableView.CanScrollHorizontally="False"
                                            Grid.Column="1" />
    
             <!-- ToggleButton that is used to expand/collapse the group. -->
             <Button x:Name="detailsToggle"
                     Template="{StaticResource detailsExpanderButtonTemplate}"
                     VerticalAlignment="Top"
                     Grid.Column="2"
                     Margin="2,4,2,0"
                     Command="{x:Static local:DataGridCommands.ToggleDetailExpansion}"
                     OverridesDefaultStyle="True"
                     Focusable="False"
                     Visibility="Collapsed"
                     views:TableView.CanScrollHorizontally="False" />
    
             <!-- This TextBlock is used to ensure that the DesiredSize for 
             the Row will never fall below the Height of a String using the inherited font size and face-->
             <TextBlock Text=""
                        Visibility="Hidden"
                        Grid.Column="3"
                        Margin="{TemplateBinding BorderThickness}" />
    
             <!-- The PART_CellsHost part designates the Panel to which this Row's Cells should be added.-->
             <views:FixedCellPanel x:Name="PART_CellsHost"
                                   Grid.Column="3"
                                   ColumnStretchMinWidth="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMinWidth}"
                                   ColumnStretchMode="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMode}"
                                   FixedCellCount="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnCount, Mode=TwoWay}"
                                   FixedColumnDropMarkPen="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnDropMarkPen}"
                                   Margin="{TemplateBinding BorderThickness}" />
          </Grid>
    
          <ControlTemplate.Triggers>
    
             <!-- When changing the appearance (e.g. background/foreground) of the Row to reflect specific
                  states (e.g. IsSelected), it is recommended to apply the changes directly to the template
                  elements because we want those modifications to be effective even when a value has been
                  explicitely set to these properties on the TemplatedParent. Also, when someone queries
                  the value of these properties on the TemplatedParent, we don't want to return the
                  intermediate, state-specific values. -->
    
             <!-- When the Row is Selected, we want to change its background/foreground to the appropriate brushes. -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                              Value="True" />               
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.IsKeyboardFocusWithin}"
                              Value="True" />
    
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="rootBorder"
                        Property="Background"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionBackground}" />
    
                <Setter TargetName="rootGrid"
                        Property="TextElement.Foreground"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionForeground}" />
    
             </MultiDataTrigger>
    
             <!-- When the Row is Selected but the parent DataGridControl is not focused, we want to change
                  the Row's background/foreground to the appropriate brushes. -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                              Value="True" />
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.IsKeyboardFocusWithin}"
                              Value="False" />
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.HideSelection}"
                              Value="False" />
    
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="rootBorder"
                        Property="Background"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionBackground}" />
    
                <Setter TargetName="rootGrid"
                        Property="TextElement.Foreground"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionForeground}" />
    
             </MultiDataTrigger>
    
             <!-- When there are details, display the Toggle button for the expansion, collapsing of the details -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                              Value="True" />
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AllowDetailToggle}"
                              Value="True" />
                   <Condition Value="True"
                              Binding="{Binding RelativeSource={RelativeSource Self}, Path=., Mode=OneWay, Converter={StaticResource typeToBooleanConverter}, ConverterParameter={x:Type local:DataRow}}" />
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="detailsToggle"
                        Property="Visibility"
                        Value="Visible" />
    
             </MultiDataTrigger>
    
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                              Value="True" />
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AllowDetailToggle}"
                              Value="True" />
                   <Condition Value="False"
                              Binding="{Binding RelativeSource={RelativeSource Self}, Path=., Mode=OneWay, Converter={StaticResource typeToBooleanConverter}, ConverterParameter={x:Type local:DataRow}}" />
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="detailsToggle"
                        Property="Visibility"
                        Value="Hidden" />
    
             </MultiDataTrigger>
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: ColumnManagerRow 
        ************************** -->
       <ControlTemplate x:Key="tableflowViewColumnManagerRowTemplate"
                        TargetType="local:ColumnManagerRow">
    
          <!-- A basic Row Template requires at least a Panel named "PART_CellsHost" to which the Row's cells will be added.
               This Panel is usually placed inside a Border who is responsible for painting the gridlines. -->
    
          <ControlTemplate.Resources>
             <conv:ThicknessConverter x:Key="thicknessConverter"
                                      InverseValue="True" />
          </ControlTemplate.Resources>
    
          <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the CellsHost panel. -->
          <Grid x:Name="rootGrid">
             <Grid.ColumnDefinitions>
                <!-- HierarchicalGroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
                <!-- GroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
    
                <!-- CellsHost panel -->
                <ColumnDefinition Width="*" />
             </Grid.ColumnDefinitions>
    
             <!-- The border responsible for the visual outline of the row (gridlines and background)
                           spans the GroupLevelIndicatorPane and CellsHost Panel. Those 2 elements are not children of
                           the Border because we don't want the border to be displayed in the GroupLevelIndicatorPane. -->
             <Border x:Name="rootBorder"
                     Grid.Column="1"
                     Grid.ColumnSpan="3"
                     views:TableView.CanScrollHorizontally="False"
                     Background="{TemplateBinding Background}"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{TemplateBinding BorderThickness}"
                     Padding="{TemplateBinding Padding}" />
    
             <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                           whenever this Row is part of a group. -->
             <local:HierarchicalGroupLevelIndicatorPane views:TableView.CanScrollHorizontally="False"
                                                        Grid.Column="0"
                                                        Background="{TemplateBinding Background}" />
             <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                            views:TableView.CanScrollHorizontally="False"
                                            Grid.Column="1"
                                            Background="{TemplateBinding Background}" />
    
             <!-- ToggleButton that is used to expand/collapse the group. -->
             <Button x:Name="detailsToggle"
                     Template="{StaticResource detailsExpanderButtonTemplate}"
                     VerticalAlignment="Top"
                     Grid.Column="2"
                     Margin="2,4,2,0"
                     Command="{x:Static local:DataGridCommands.ToggleDetailExpansion}"
                     OverridesDefaultStyle="True"
                     Focusable="False"
                     Visibility="Collapsed"
                     views:TableView.CanScrollHorizontally="False" />
    
             <Decorator x:Name="indentationDecorator"
                        Grid.Column="3">
    
                <!-- The PART_CellsHost part designates the Panel to which this Row's Cells should be added.-->
                <views:FixedCellPanel x:Name="PART_CellsHost"
                                      ColumnStretchMinWidth="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMinWidth}"
                                      ColumnStretchMode="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMode}"
                                      FixedCellCount="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnCount, Mode=TwoWay}"
                                      FixedColumnDropMarkPen="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnDropMarkPen}"
                                      Margin="{TemplateBinding BorderThickness}" />
             </Decorator>
    
          </Grid>
    
          <ControlTemplate.Triggers>
             <!-- When there are details, display the Toggle button for the expansion, collapsing of the details -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                              Value="True" />
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AllowDetailToggle}"
                              Value="True" />
    
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="detailsToggle"
                        Property="Visibility"
                        Value="Hidden" />
    
             </MultiDataTrigger>
    
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: Cell 
        ************************** -->
       <ControlTemplate x:Key="tableflowViewCellTemplate"
                        TargetType="local:Cell">
    
          <!-- A basic Cell Template requires at least a ContentPresenter that is used to display the Cell's Content.
               This ContentPresenter is usually placed inside a Border who is responsible for painting the gridlines. -->
    
          <Grid>
             <Border x:Name="gridLinesBorder" />
    
             <Border x:Name="rootBorder"
                     Background="{TemplateBinding Background}"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{TemplateBinding BorderThickness}"
                     Padding="{TemplateBinding Padding}">
    
                <local:CellContentPresenter x:Name="PART_CellContentPresenter"
                                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    
             </Border>
          </Grid>
    
          <ControlTemplate.Triggers>
    
             <!-- When changing the appearance (e.g. background/foreground) of the Cell to reflect specific
                  states (e.g. IsCurrent), it is recommended to apply the changes directly to the template
                  elements because we want those modifications to be effective even when a value has been
                  explicitely set to these properties on the TemplatedParent. Also, when someone queries
                  the value of these properties on the TemplatedParent, we don't want to return the
                  intermediate, state-specific values. -->
    
             <!-- When the Cell is Current, we want to change its background/foreground to the appropriate brushes.
                  We do this only when the cell does not have a validation error because we must give priority
                  to the CellErrorStyle (if present).-->
    
             <MultiTrigger>
                <MultiTrigger.Conditions>
    
                   <Condition Property="IsCurrent"
                              Value="True" />
    
                   <Condition Property="HasValidationError"
                              Value="False" />
    
                </MultiTrigger.Conditions>
    
                <Setter TargetName="rootBorder"
                        Property="Background"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentBackground}" />
    
                <Setter TargetName="rootBorder"
                        Property="TextElement.Foreground"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentForeground}" />
    
             </MultiTrigger>
    
             <MultiTrigger>
                <MultiTrigger.Conditions>
    
                   <Condition Property="IsCurrent"
                              Value="True" />
    
                   <Condition Property="HasValidationError"
                              Value="True" />
    
                   <Condition Property="CellErrorStyle"
                              Value="{x:Null}" />
    
                </MultiTrigger.Conditions>
    
                <Setter TargetName="rootBorder"
                        Property="Background"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentBackground}" />
    
                <Setter TargetName="rootBorder"
                        Property="TextElement.Foreground"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentForeground}" />
    
             </MultiTrigger>
    
             <!-- When the Cell is Selected, we want to change its background/foreground to the appropriate brushes. -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                              Value="True" />
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).IsKeyboardFocusWithin}"
                              Value="True" />
    
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="rootBorder"
                        Property="Background"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionBackground}" />
    
                <Setter TargetName="rootBorder"
                        Property="TextElement.Foreground"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionForeground}" />
    
             </MultiDataTrigger>
    
             <!-- When the Cell is Selected but the parent DataGridControl is not focused, we want to change
                  the Cell's background/foreground to the appropriate brushes. -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                              Value="True" />
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).IsKeyboardFocusWithin}"
                              Value="False" />
    
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).HideSelection}"
                              Value="False" />
    
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="rootBorder"
                        Property="Background"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionBackground}" />
    
                <Setter TargetName="rootBorder"
                        Property="TextElement.Foreground"
                        Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionForeground}" />
    
             </MultiDataTrigger>
    
             <!-- When the Cell's content is Null and the row is not being edited, we want to ensure that the row/cell
                  will preserve a minimum height based on the current font size for the row/cell. To do this, we override
                  the ContentPresenter's content binding and replace it with an empty string (""), the textbox generated 
                  this way will then size to the default text's height. When trigger is not active anymore, default binding
                  is restored automatically. -->
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}"
                          Value="False">
                <Setter Property="Visibility"
                        Value="Collapsed" />
             </DataTrigger>
    
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AreColumnsBeingReordered}"
                              Value="True" />
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="gridLinesBorder"
                        Property="BorderBrush"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineBrush}" />
    
                <Setter TargetName="gridLinesBorder"
                        Property="BorderThickness"
                        Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Left'}" />
    
                <Setter TargetName="gridLinesBorder"
                        Property="Margin"
                        Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource inverseThicknessConverter},ConverterParameter='Left'}" />
    
             </MultiDataTrigger>
    
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: ColumnManagerCell 
        ************************** -->
       <ControlTemplate x:Key="tableflowViewColumnManagerCellTemplate"
                        TargetType="local:ColumnManagerCell">
    
          <!-- We don't use the base Cell Template for the ColumnManagerCell because it need more elements
               to function properly: a Thumb named "PART_ColumnResizerThumb" that is used to resize the
               ColumnManagerCells's ParentColumn.Width and a glyph that represents the Column's SortDirection. -->
          <Grid>
    
             <Border x:Name="gridLinesBorder" />
    
             <Border  BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}">
    
                <!-- This Grid is used to position the resizer Thumb over the ColumnManagerCell -->
                <Grid>
    
                   <Rectangle Fill="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"
                              HorizontalAlignment="Left"
                              VerticalAlignment="Stretch"
                              Width="1"
                              Margin="0,2,0,2" />
    
                   <Rectangle Fill="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"
                              HorizontalAlignment="Right"
                              VerticalAlignment="Stretch"
                              Width="1"
                              Margin="0,2,0,2" />
    
                   <DockPanel>
                      <Border x:Name="thumbToggleBackgroundBorder"
                              DockPanel.Dock="Right">
    
                         <Grid>
    
                            <Border x:Name="toggleDelimeterBorder"
                                    BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"
                                    BorderThickness="1,0,0,0"
                                    Margin="0,4,0,4"
                                    Background="Transparent"
                                    Visibility="Collapsed">
    
                               <Border x:Name="toggleDelimeterBorder2"
                                       BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"
                                       BorderThickness="1,0,0,0"
                                       Margin="0,0,0,0"
                                       Background="Transparent"
                                       Visibility="Collapsed">
    
                               </Border>
    
                            </Border>
    
                            <ToggleButton x:Name="toggleButton"
                                          Focusable="False"
                                          VerticalAlignment="Stretch"
                                          Visibility="Collapsed"
                                          Margin="2,0,0,0"
                                          Opacity="0.5" />
    
                         </Grid>
    
                      </Border>
    
                      <Border Background="{TemplateBinding Background}">
    
                         <!-- This Grid is used to layout the delimiter lines on top of the ContentPresenter -->
                         <Grid>
    
                            <Border Padding="{TemplateBinding Padding}">
    
                               <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
                               <StackPanel x:Name="contentPanel"
                                           Orientation="Horizontal">
    
                                  <!-- Same ContentPresenter as in the base Cell Template. -->
                                  <local:CellContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    
                                  <!-- ContentPresenter that is used to display the sort glyph.
                              We explicitly set its Content property to Null to prevent the XAML parser
                              from implicitly setting it to its TemplatedParent's Content. -->
                                  <ContentPresenter x:Name="sortGlyphPresenter"
                                                    Content="{x:Null}"
                                                    ContentTemplate="{x:Null}" />
    
                               </StackPanel>
                            </Border>
    
                         </Grid>
    
                      </Border>
    
                   </DockPanel>
    
                   <!-- Thumb that is used to resize the Column. -->
                   <Thumb x:Name="PART_ColumnResizerThumbLeft"
                          Style="{StaticResource invisibleThumbStyle}"
                          Width="6"
                          HorizontalAlignment="Left" />
    
                   <!-- Thumb that is used to resize the Column. -->
                   <Thumb x:Name="PART_ColumnResizerThumb"
                          Style="{StaticResource invisibleThumbStyle}"
                          Width="6"
                          HorizontalAlignment="Right" />
    
                </Grid>
    
             </Border>
          </Grid>
    
          <ControlTemplate.Triggers>
    
             <!-- Trigger related to the filteringToggleButton-->
             <Trigger SourceName="toggleButton"
                      Property="IsMouseOver"
                      Value="True">
    
                <Setter TargetName="toggleButton"
                        Property="Opacity"
                        Value="1" />
             </Trigger>
    
             <Trigger Property="IsPressed"
                      Value="True">
    
                <Setter TargetName="contentPanel"
                        Property="Margin"
                        Value="1,1,-1,-1" />
    
             </Trigger>
    
             <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed
                  depending on the ParentColumn's SortDirection. -->
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.SortDirection}"
                          Value="Ascending">
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="ContentPresenter.ContentTemplate"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AscendingSortGlyph}" />
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="Margin"
                        Value="6,0,0,0" />
    
             </DataTrigger>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.SortDirection}"
                          Value="Descending">
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="ContentPresenter.ContentTemplate"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DescendingSortGlyph}" />
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="Margin"
                        Value="6,0,0,0" />
    
             </DataTrigger>
    
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.HasFixedWidth}"
                              Value="True" />
    
                   <!-- Don't disable resizing if ColumnStretching can be disabled by an 
                        end-user resize. -->
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).RemoveColumnStretchingOnResize}"
                              Value="False" />
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="PART_ColumnResizerThumb"
                        Property="IsEnabled"
                        Value="False" />
             </MultiDataTrigger>
    
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.PreviousVisibleColumn.HasFixedWidth}"
                              Value="True" />
    
                   <!-- Don't disable resizing if ColumnStretching can be disabled by an 
                        end-user resize. -->
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).RemoveColumnStretchingOnResize}"
                              Value="False" />
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="PART_ColumnResizerThumbLeft"
                        Property="IsEnabled"
                        Value="False" />
             </MultiDataTrigger>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentRow.AllowColumnResize}"
                          Value="False">
                <Setter TargetName="PART_ColumnResizerThumb"
                        Property="IsEnabled"
                        Value="False" />
                <Setter TargetName="PART_ColumnResizerThumbLeft"
                        Property="IsEnabled"
                        Value="False" />
             </DataTrigger>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}"
                          Value="False">
                <Setter Property="Visibility"
                        Value="Collapsed" />
             </DataTrigger>
    
             <!-- To display the left vertical grid line when doing animated Column reordering -->
             <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AreColumnsBeingReordered}"
                              Value="True" />
                </MultiDataTrigger.Conditions>
    
                <Setter TargetName="gridLinesBorder"
                        Property="BorderBrush"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineBrush}" />
    
                <Setter TargetName="gridLinesBorder"
                        Property="BorderThickness"
                        Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Left'}" />
    
                <Setter TargetName="gridLinesBorder"
                        Property="Margin"
                        Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource inverseThicknessConverter},ConverterParameter='Left'}" />
    
             </MultiDataTrigger>
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: GroupByControl
        ************************** -->
       <ControlTemplate x:Key="tableflowViewGroupByControlTemplate"
                        TargetType="local:GroupByControl">
    
          <Border Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  Padding="{TemplateBinding Padding}">
    
             <!-- This Grid is used to position the ItemsPresenter over the ContentPresenter in charge
                  of displaying the NoGroupContent. -->
             <Grid>
    
                <!-- This ContentPresenter displays the value of the NoGroupContent property
                     of the GroupByControl. This content must only be displayed when there are
                     no groups present, so we set its Visibility to Collapsed by default and
                     it is made visible via a trigger. -->
                <ContentPresenter x:Name="noGroupContentPresenter"
                                  Content="{TemplateBinding NoGroupContent}"
                                  VerticalAlignment="Center"
                                  Visibility="Collapsed" />
    
                <!-- The GroupByControl is an ItemsControl, so it must have an ItemsPresenter in its
                     Template in order to layout and show its child items. The default ItemsPanel
                     of the GroupByControl is a "StaircasePanel", which layout its items in a
                     staircase-like pattern and draws connecting lines between the items. -->
                <ItemsPresenter />
    
             </Grid>
          </Border>
    
          <ControlTemplate.Triggers>
    
             <!-- When there are no groups, make the NoGroupContent visible. -->
             <Trigger Property="HasItems"
                      Value="False">
    
                <Setter TargetName="noGroupContentPresenter"
                        Property="Visibility"
                        Value="Visible" />
             </Trigger>
    
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: GroupByItem
        ************************** -->
       <ControlTemplate x:Key="tableflowViewGroupByItemTemplate"
                        TargetType="local:GroupByItem">
    
          <Border Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  Padding="{TemplateBinding Padding}">
    
             <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
             <StackPanel Orientation="Horizontal">
    
                <!-- Same ContentPresenter as in the base Cell Template. -->
                <ContentPresenter Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    
                <!-- ContentPresenter that is used to display the sort glyph.
                     We explicitely set its Content property to Null to prevent the XAML parser
                     from implicitely setting it to its TemplatedParent's Content. -->
                <ContentPresenter x:Name="sortGlyphPresenter"
                                  Content="{x:Null}"
                                  ContentTemplate="{x:Null}" />
    
             </StackPanel>
          </Border>
    
          <ControlTemplate.Triggers>
    
             <!-- The following 2 triggers allow to display the appropriate Sort Glyph
                  depending on the ParentColumn's SortDirection. -->
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                          Value="Ascending">
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="ContentPresenter.ContentTemplate"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AscendingSortGlyph}" />
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="Margin"
                        Value="6,0,0,0" />
    
             </DataTrigger>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                          Value="Descending">
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="ContentPresenter.ContentTemplate"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DescendingSortGlyph}" />
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="Margin"
                        Value="6,0,0,0" />
    
             </DataTrigger>
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: GroupHeaderControl
        ************************** -->
       <conv:IntAdditionConverter x:Key="groupHeaderControlGroupLevelConverter" />
       <ControlTemplate x:Key="tableflowViewGroupHeaderControlTemplate"
                        TargetType="local:GroupHeaderControl">
    
          <!-- Using this decorator will prevent the GroupHeaderControl of exceeding the width 
               defined by the grid's column. -->
          <views:PassiveLayoutDecorator Axis="Horizontal">
             <!-- This DockPanel is used to layout the GroupLevelIndicatorPane placeholder and the GroupHeaderControl Content. -->
             <DockPanel>
    
                <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                  whenever this GroupHeaderControl is part of a group. -->
                <local:HierarchicalGroupLevelIndicatorPane DockPanel.Dock="Left" />
                <local:GroupLevelIndicatorPane DockPanel.Dock="Left"
                                               Indented="False"
                                               local:GroupLevelIndicatorPane.GroupLevel="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:GroupLevelIndicatorPane.GroupLevel), Converter={StaticResource groupHeaderControlGroupLevelConverter}, ConverterParameter=-1}" />
    
                <!-- Main Border for the GroupHeaderControl. It is Focusable to make the InputBindings work. -->
                <Border x:Name="mainBorder"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}"
                        Focusable="True"
                        FocusVisualStyle="{TemplateBinding FocusVisualStyle}">
    
                   <!-- Define all the standard InputBindings for a GroupHeaderControl. -->
                   <Border.InputBindings>
                      <KeyBinding Command="{x:Static local:DataGridCommands.ToggleGroupExpansion}"
                                  Key="Space" />
    
                      <KeyBinding Command="{x:Static local:DataGridCommands.ExpandGroup}"
                                  Key="Right" />
    
                      <KeyBinding Command="{x:Static local:DataGridCommands.ExpandGroup}"
                                  Key="Add" />
    
                      <KeyBinding Command="{x:Static local:DataGridCommands.CollapseGroup}"
                                  Key="Left" />
    
                      <KeyBinding Command="{x:Static local:DataGridCommands.CollapseGroup}"
                                  Key="Subtract" />
    
                      <MouseBinding Command="{x:Static local:DataGridCommands.ToggleGroupExpansion}"
                                    MouseAction="LeftDoubleClick" />
    
                   </Border.InputBindings>
    
                   <!-- This StackPanel is used to layout the ToggleButton and the GroupHeaderControl. -->
                   <StackPanel Orientation="Horizontal">
    
                      <!-- ToggleButton that is used to expand/collapse the group. -->
                      <ToggleButton Template="{StaticResource groupExpanderToggleButtonTemplate}"
                                    OverridesDefaultStyle="True"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Focusable="False"
                                    IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Group.IsExpanded}" />
    
                      <!-- ContentPresenter in charge of displaying this GroupHeaderControl's Content, which is
                                 a Group by default. -->
                      <ContentPresenter Margin="3,0,0,0"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    
                   </StackPanel>
                </Border>
             </DockPanel>
          </views:PassiveLayoutDecorator>
    
          <ControlTemplate.Triggers>
             <Trigger Property="local:DataGridControl.NavigationBehavior"
                      Value="None">
                <Setter TargetName="mainBorder"
                        Property="Focusable"
                        Value="False" />
             </Trigger>
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: GroupLevelIndicator
        ************************** -->
       <ControlTemplate x:Key="tableflowViewGroupLevelIndicatorTemplate"
                        TargetType="local:GroupLevelIndicator">
    
          <Border Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  Padding="{TemplateBinding Padding}" />
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: DetailIndicator
        ************************** -->
       <ControlTemplate x:Key="tableflowViewDetailIndicatorTemplate"
                        TargetType="local:DetailIndicator">
    
          <Border Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  Padding="{TemplateBinding Padding}" />
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: GroupLevelIndicatorPane
        ************************** -->
       <ControlTemplate x:Key="tableflowViewGroupLevelIndicatorPaneTemplate"
                        TargetType="local:GroupLevelIndicatorPane">
          <Grid>
    
             <Border x:Name="horizontalBorder"
                     Background="{TemplateBinding Background}"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Top'}" />
    
             <Border x:Name="verticalBorder"
                     BorderBrush="{TemplateBinding BorderBrush}"
                     Padding="{TemplateBinding Padding}"
                     BorderThickness="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Left'}">
                <StackPanel x:Name="PART_GroupLevelIndicatorHost"
                            Orientation="Horizontal" />
             </Border>
    
          </Grid>
          <ControlTemplate.Triggers>
             <MultiTrigger>
                <MultiTrigger.Conditions>
                   <Condition Property="IsLeaf"
                              Value="True" />
                   <Condition Property="views:ViewBase.IsLastItem"
                              Value="True" />
                   <Condition Property="local:DataGridControl.HasExpandedDetails"
                              Value="False" />
                </MultiTrigger.Conditions>
                <Setter TargetName="horizontalBorder"
                        Property="BorderThickness"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Top, Bottom'}" />
                <Setter TargetName="verticalBorder"
                        Property="Margin"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Bottom'}" />
             </MultiTrigger>
    
             <MultiTrigger>
                <MultiTrigger.Conditions>
    
                   <Condition Property="CurrentIndicatorCount"
                              Value="0" />
    
                   <Condition Property="IsLeaf"
                              Value="False" />
    
                </MultiTrigger.Conditions>
    
                <Setter TargetName="verticalBorder"
                        Property="BorderThickness"
                        Value="0" />
    
             </MultiTrigger>
    
             <Trigger Property="ShowVerticalBorder"
                      Value="False">
                <Setter TargetName="verticalBorder"
                        Property="BorderThickness"
                        Value="0" />
             </Trigger>
    
          </ControlTemplate.Triggers>
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: HierarchicalGroupLevelIndicatorPane
        ************************** -->
       <ControlTemplate x:Key="tableflowViewHierarchicalGroupLevelIndicatorPaneTemplate"
                        TargetType="local:HierarchicalGroupLevelIndicatorPane">
          <Border BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
             <StackPanel x:Name="PART_GroupLevelIndicatorHost"
                         Orientation="Horizontal" />
          </Border>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: HierarchicalGroupByControl
        ************************** -->
    
       <!-- DataTemplate for DataGridContext displayed inside the HierarchicalGroupByControl -->
       <HierarchicalDataTemplate x:Key="dataGridContextTemplate"
                                 DataType="{x:Type local:DataGridContext}"
                                 ItemsSource="{Binding Path=DetailConfigurations}">
    
          <local:HierarchicalGroupByControlNode x:Name="groupByControlNode"
                                                ItemsSource="{Binding Path=GroupLevelDescriptions}"
                                                Title="{Binding Path=SourceDetailConfiguration.Title}" />
    
          <!-- Trigger to bind Title to the DataGridContext.DataGridControl.ItemsSourceName if DataGridContext.ParentDataGridContext is null -->
          <HierarchicalDataTemplate.Triggers>
             <DataTrigger Binding="{Binding Path=SourceDetailConfiguration}"
                          Value="{x:Null}">
                <Setter TargetName="groupByControlNode"
                        Property="Title">
                   <Setter.Value>
                      <Binding Path="DataGridControl.ItemsSourceName" />
                   </Setter.Value>
                </Setter>
             </DataTrigger>
          </HierarchicalDataTemplate.Triggers>
    
       </HierarchicalDataTemplate>
    
       <!-- DataTemplate for DetailConfiguration displayed inside the HierarchicalGroupByControlNode -->
       <HierarchicalDataTemplate x:Key="detailConfigurationTemplate"
                                 DataType="{x:Type local:DetailConfiguration}"
                                 ItemsSource="{Binding Path=DetailConfigurations}">
    
          <local:HierarchicalGroupByControlNode ItemsSource="{Binding Path=GroupLevelDescriptions}"
                                                Title="{Binding Title}" />
       </HierarchicalDataTemplate>
    
       <conv:TypeToVisibilityConverter x:Key="notDetailConfigConverter"
                                       Visibility="Visible"
                                       SetVisibilityWhenTrue="False" />
    
       <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
    
       <!-- TreeViewItem Style to avoid displaying Expander and avoid selection and click -->
       <Style x:Key="hierarchicalGroupByControlTreeViewItemStyle"
              TargetType="{x:Type TreeViewItem}">
    
          <Setter Property="IsExpanded"
                  Value="True" />
    
          <Setter Property="Focusable"
                  Value="False" />
    
          <Setter Property="Visibility">
             <Setter.Value>
                <PriorityBinding>
                   <Binding Path="."
                            Converter="{StaticResource notDetailConfigConverter}"
                            ConverterParameter="{x:Type local:DetailConfiguration}" />
                   <Binding Path="Visible"
                            Converter="{StaticResource booleanToVisibilityConverter}" />
                </PriorityBinding>
    
             </Setter.Value>
          </Setter>
    
          <Setter Property="Template">
             <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                   <Grid>
                      <Grid.ColumnDefinitions>
    
                         <!--This ColumnDefinition is required for stair spacing-->
                         <ColumnDefinition Width="19" />
                         <ColumnDefinition Width="Auto" />
                         <ColumnDefinition Width="*" />
                      </Grid.ColumnDefinitions>
                      <Grid.RowDefinitions>
                         <RowDefinition Height="Auto" />
                         <RowDefinition />
                      </Grid.RowDefinitions>
    
                      <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
                              Padding="{TemplateBinding Control.Padding}"
                              BorderBrush="{TemplateBinding Border.BorderBrush}"
                              Background="{TemplateBinding Panel.Background}"
                              Name="treeViewItemBorder"
                              SnapsToDevicePixels="True"
                              Grid.Column="1">
    
                         <!--Will contain DetailGroupByConrol-->
    
                         <ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}"
                                           ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}"
                                           ContentSource="Header"
                                           Name="PART_Header"
                                           HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                           SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                      </Border>
    
                      <ItemsPresenter Name="ItemsHost"
                                      Grid.Column="1"
                                      Grid.Row="1"
                                      Grid.ColumnSpan="2" />
                   </Grid>
                </ControlTemplate>
             </Setter.Value>
          </Setter>
       </Style>
    
       <ControlTemplate x:Key="tableflowViewCommonHierarchicalGroupByControlTemplate"
                        TargetType="local:HierarchicalGroupByControl">
          <ControlTemplate.Resources>
             <!--this style is set to avoid having implicit treeview style
                 overide the HierarchicalGroupByControl's TreeView-->
             <Style TargetType="TreeView" />
          </ControlTemplate.Resources>
    
          <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the HierarchicalGroupByControl -->
          <Grid x:Name="rootGrid">
             <Grid.ColumnDefinitions>
                <!-- HierarchicalGroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
                <!-- GroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
    
                <!-- HierarchicalGroupByControl -->
                <ColumnDefinition Width="*" />
             </Grid.ColumnDefinitions>
    
             <!-- The border responsible for the visual outline of the row (gridlines and background)
                  spans the GroupLevelIndicatorPane and CellsHost Panel. Those 2 elements are not children of
                  the Border because we don't want the border to be displayed in the GroupLevelIndicatorPane. -->
             <Border x:Name="rootBorder"
                     Grid.Column="1"
                     Grid.ColumnSpan="2"
                     Background="{TemplateBinding Background}"
                     BorderBrush="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineBrush}"
                     BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Top'}"
                     Padding="{TemplateBinding Padding}" />
    
             <Border x:Name="verticalGridLineBorder"
                     Grid.Column="1"
                     Grid.ColumnSpan="2"
                     BorderBrush="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineBrush}"
                     BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Right'}" />
    
             <local:HierarchicalGroupLevelIndicatorPane Grid.Column="0" />
    
             <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                           whenever this Row is part of a group. -->
             <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                            Grid.Column="1" />
    
             <StackPanel Grid.Column="2"
                         Orientation="Horizontal">
    
                <TreeView x:Name="PART_HierarchicalGroupByControlTreeView"
                          ItemContainerStyle="{StaticResource hierarchicalGroupByControlTreeViewItemStyle}"
                          Background="Transparent"
                          BorderBrush="Transparent"
                          Focusable="False">
    
                   <TreeViewItem Header="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext)}"
                                 HeaderTemplate="{StaticResource dataGridContextTemplate}"
                                 ItemsSource="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DetailConfigurations}"
                                 ItemTemplate="{StaticResource detailConfigurationTemplate}"
                                 ItemContainerStyle="{StaticResource hierarchicalGroupByControlTreeViewItemStyle}"
                                 IsExpanded="True" />
                </TreeView>
    
                <ContentPresenter x:Name="noGroupContentPresenter"
                                  Content="{TemplateBinding NoGroupContent}"
                                  VerticalAlignment="Center"
                                  Visibility="Collapsed"
                                  Margin="5,0,0,0" />
    
             </StackPanel>
    
          </Grid>
          <ControlTemplate.Triggers>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=HasGroups}"
                          Value="True">
    
                <Setter TargetName="noGroupContentPresenter"
                        Property="Visibility"
                        Value="Visible" />
    
             </DataTrigger>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:GroupLevelIndicatorPane.GroupLevel)}"
                          Value="-1">
                <Setter TargetName="groupLevelIndicatorPane"
                        Property="Visibility"
                        Value="Collapsed" />
                <Setter TargetName="verticalGridLineBorder"
                        Property="BorderThickness"
                        Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Right, Left'}" />
             </DataTrigger>
    
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <ControlTemplate x:Key="tableflowViewCommonHierarchicalGroupByControlOldGroupByControlTemplate"
                        TargetType="local:HierarchicalGroupByControl">
    
          <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the HierarchicalGroupByControl -->
          <Grid x:Name="rootGrid">
             <Grid.ColumnDefinitions>
                <!-- HierarchicalGroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
                <!-- GroupLevelIndicatorPane -->
                <ColumnDefinition Width="Auto" />
    
                <!-- HierarchicalGroupByControl -->
                <ColumnDefinition Width="*" />
             </Grid.ColumnDefinitions>
    
             <!-- The border responsible for the visual outline of the row (gridlines and background)
                  spans the GroupLevelIndicatorPane and CellsHost Panel. Those 2 elements are not children of
                  the Border because we don't want the border to be displayed in the GroupLevelIndicatorPane. -->
             <Border x:Name="rootBorder"
                     Grid.Column="1"
                     Grid.ColumnSpan="2"
                     Background="{TemplateBinding Background}"
                     BorderBrush="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineBrush}"
                     BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Top'}"
                     Padding="{TemplateBinding Padding}" />
    
             <Border x:Name="verticalGridLineBorder"
                     Grid.Column="1"
                     Grid.ColumnSpan="2"
                     BorderBrush="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineBrush}"
                     BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Right'}" />
    
             <local:HierarchicalGroupLevelIndicatorPane Grid.Column="0" />
    
             <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                           whenever this Row is part of a group. -->
             <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                            Grid.Column="1" />
    
             <local:GroupByControl Grid.Column="2"
                                   BorderBrush="{TemplateBinding BorderBrush}"
                                   Background="{TemplateBinding Background}"
                                   BorderThickness="{TemplateBinding BorderThickness}"
                                   AllowGroupingModification="{TemplateBinding AllowGroupingModification}"
                                   AllowSort="{TemplateBinding AllowSort}"
                                   ConnectionLinePen="{TemplateBinding ConnectionLinePen}"
                                   NoGroupContent="{TemplateBinding NoGroupContent}"
                                   views:TableView.CanScrollHorizontally="True" />
    
          </Grid>
    
          <ControlTemplate.Triggers>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:GroupLevelIndicatorPane.GroupLevel)}"
                          Value="-1">
                <Setter TargetName="groupLevelIndicatorPane"
                        Property="Visibility"
                        Value="Collapsed" />
                <Setter TargetName="verticalGridLineBorder"
                        Property="BorderThickness"
                        Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Right, Left'}" />
             </DataTrigger>
    
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: HierarchicalGroupByControlNode
        ************************** -->
       <ControlTemplate x:Key="tableflowViewHierarchicalGroupByControlNodeTemplate"
                        TargetType="local:HierarchicalGroupByControlNode">
    
          <StackPanel Orientation="Horizontal"
                      Background="{TemplateBinding Background}">
    
             <TextBlock x:Name="titleTextBlock"
                        Text="{TemplateBinding Title}"
                        Margin="0,0,10,0" />
    
             <ItemsPresenter Margin="0,0,0,10" />
          </StackPanel>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: HierarchicalGroupByItem
        ************************** -->
       <ControlTemplate x:Key="tableflowViewHierarchicalGroupByItemTemplate"
                        TargetType="local:HierarchicalGroupByItem">
    
          <Border x:Name="outerBorder"
                  BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"
                  Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"
                  BorderThickness="0,0,1,1"
                  Padding="1,1,0,0">
    
             <Border x:Name="innerBorder"
                     BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"
                     BorderThickness="0,0,1,1"
                     Margin="1,1,0,0"
                     Background="{TemplateBinding Background}"
                     Padding="{TemplateBinding Padding}">
    
                <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
                <StackPanel x:Name="contentPanel"
                            Orientation="Horizontal">
    
                   <!-- Same ContentPresenter as in the base Cell Template. -->
                   <ContentPresenter Content="{TemplateBinding Content}"
                                     ContentTemplate="{TemplateBinding ContentTemplate}"
                                     ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    
                   <!-- ContentPresenter that is used to display the sort glyph.
                        We explicitly set its Content property to Null to prevent the XAML parser
                        from implicitly setting it to its TemplatedParent's Content. -->
                   <ContentPresenter x:Name="sortGlyphPresenter"
                                     Content="{x:Null}"
                                     ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AscendingSortGlyph}"
                                     Margin="6,0,0,0"
                                     Visibility="Hidden" />
    
                </StackPanel>
    
             </Border>
    
          </Border>
    
          <ControlTemplate.Triggers>
    
             <Trigger Property="IsPressed"
                      Value="True">
    
                <Setter TargetName="outerBorder"
                        Property="BorderBrush"
                        Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" />
    
                <Setter TargetName="outerBorder"
                        Property="BorderThickness"
                        Value="1" />
    
                <Setter TargetName="outerBorder"
                        Property="Padding"
                        Value="0" />
    
                <Setter TargetName="innerBorder"
                        Property="BorderThickness"
                        Value="1" />
    
                <Setter TargetName="innerBorder"
                        Property="Margin"
                        Value="0" />
    
                <Setter TargetName="contentPanel"
                        Property="Margin"
                        Value="1,1,-1,-1" />
    
             </Trigger>
    
             <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed
                  depending on the ParentColumn's SortDirection. -->
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                          Value="Ascending">
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="ContentPresenter.ContentTemplate"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AscendingSortGlyph}" />
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="Visibility"
                        Value="Visible" />
    
             </DataTrigger>
    
             <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                          Value="Descending">
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="ContentPresenter.ContentTemplate"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DescendingSortGlyph}" />
    
                <Setter TargetName="sortGlyphPresenter"
                        Property="Visibility"
                        Value="Visible" />
    
             </DataTrigger>
          </ControlTemplate.Triggers>
    
       </ControlTemplate>
    
       <!--**************************
        * TEMPLATE: ScrollTip
        ************************** -->
       <ControlTemplate x:Key="tableflowViewScrollTipTemplate"
                        TargetType="{x:Type local:ScrollTip}">
          <ContentPresenter VerticalAlignment="Center"
                            HorizontalAlignment="Right"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
       </ControlTemplate>
    
    </ResourceDictionary>

     

    转载于:https://www.cnblogs.com/naliang/p/3839842.html

    更多相关内容
  • Xceed DataGrid for WPF 试用版 试用版 开发语言: NET 可用平台: Visual Studio 2010/2012/2013 当前版本: v5.7 Xceed DataGrid(Windows Presentation Foundation)是一款表格控制组件,它具有类似于Vista、XP...
  • Xceed DataGrid for WPF v3.5
  • Xceed DataGrid(Windows Presentation Foundation)是一款来自龙博方案网的表格控制组件,它具有类似于Vista、XP、媒体中心或经典风格的传统表格以及卡片浏览模式并能让您在3D设计版面中显示与编辑数据。...

    Xceed DataGrid(Windows Presentation Foundation)是一款来自龙博方案网的表格控制组件,它具有类似于Vista、XP、媒体中心或经典风格的传统表格以及卡片浏览模式并能让您在3D设计版面中显示与编辑数据。丰富的就地编辑功能、具有UI虚拟化的分组功能、高品质的浏览功能(表格与卡片)以及内置数据验证功能。它同样包括WPF日期挑选程序以及日历控制组件。WPF的Xceed DataGrid提供了具有绑定与非绑定数据源的功能;灵活的对象模型以及具有可循环使用成分的完全可扩展功能。WPF的Xceed DataGrid的Express版本是免费版本。请访问龙博方案网查看怎样获得免费授权的说明。龙博方案网提供所有的C#与XAML源代码

    具体功能:

    WPF / .NET技术

    • 完全为WPF与.NET 3.0设计制作,以C#与XAML编写而成。同样支持.NET 3.5。
    • 在Blueprint版本中提供完整的源代码。(只有专业版本才提供)
    • 可变换风格与模板的WPF控制组件。您能完全改变整个控制组件的外观以及工作模式。制作3D rolodex、carousel、timeline views等。
    • 支持UI的虚拟化,即便是在对数据进行分组时。所以只能制作与保留在当前可以浏览的元素成分,这意味着更快的加载速度以及占用更少的内存。
    • Visual Studio 2008与Expression Blend中设计阶段的支持。
    • 能让您快速简单地创建最重要功能的设计阶段配置窗口。

    主要功能

    • 提供分级的主要/具体功能。
    • 在主网格或主信息中的每行数据都能拥有数目不限的详细信息。
    • 详细信息能拥有平级信息或子信息,或两者皆有。
    • 详细信息支持标题、脚注、分组、分类以及自动过滤功能。
    • 包含在每一同级信息中的数据项能拥有不同的风格。
    • 支持在网格以及信息中进行自定义分组。
    • 支持自定义的信息关联。

    浏览与主题

    • 能显示数据并让用户在任何您能想象的2D或3D设计版面中对数据进行编辑。
    • 提供两种2D浏览模式(传统的表格模式与卡片模式)。能达到具有真实本地WPF控制组件的传统XP或Vista应用程序的外观效果。
    • 提供所有Microsoft Windows的主题:Classic (NT)、Luna (XP)、Aero (Vista)以及Royale (媒体中心) 。
    • 丰富的就地编辑功能。
    • 功能丰富的就地编辑功能可以在所有浏览模式下工作。
    • 提供可配置的键盘以及鼠标编辑命令。
    • 对编辑模式的程序化控制。
    • 提供Excel类似的默认键盘与鼠标编辑行为,包括F2、ESC(删除对单元格的编辑并还原成原始值),Double-Esc(删除对整行的编辑并还原原始值)以及Enter。
    • 能让您为即将被编辑的单元格指定不同的视觉模板。
    • 勿需进入编辑模式就能显示单元格编辑器,如在鼠标指针移动到单元格或行之上时;当单元格或行即将变为当前选项时;又如当正在对行进行编辑时等。

    数据分组

    • 在所有浏览模式中支持分级、多级的分组。
    • 具有标题与脚注支持的可自定义的分级配置。
    • 支持UI的虚拟化,即便是在分组时也可节约内存以及减少加载时间。
    • 支持自定义的分组标准以让您的代码能按照您自己设置的条件进行分组排列。
    • 交互式、分级的按行分组功能能让最终用户简单地创建以及处理各个组。接受所有包含的浏览模式。
    • 对扩展和隐藏的组具有程序化的控制。
    • 分组可通过代码进行控制。

    输入验证

    • 在单元格或行级别上包含了内置数据验证。
    • 错误显示融合了包含的浏览模式。
    • 当出现验证错误时,您能定义单元格或行外观的风格。
    • 能以任何标准进行验证,包括其他的单元格的值。
    • 验证错误消息可超界以及可本地化。
    • 可通过您已经建立的自定义验证规则进行扩展以及兼容操作。

    卡片浏览功能

    • 通过水平滚动默认将卡片堆叠到列中。
    • 包含了两种类型的卡片浏览风格:压缩卡片浏览模式(具有列分隔线的没有边框的卡片)以及标准卡片浏览模式(有边框的卡片,但不具有分隔线)。
    • 支持多级分组。按行分组包括了列的内置列表,所以尽管没有列标题,但最终用户仍然能通过列进行分组。
    • 在卡片列表里对标题进行分组并记录字段。
    • 能独立调整卡片的大小,从卡片本身的大小到它的内容都能进行调整。

    表格浏览功能

    • 包含了具有您能想象的所有典型元素成分的Outlook风格的表格浏览模式。
    • 列标题支持能拖放的列记录、列大小调整、点击分类以及拖动的按行分组功能。
    • 行距选择与调整行的大小并可以显示能表示当前行、正在编辑、插入或具有验证错误的图标。
    • 提供水平与垂直的网格线刷以及网格线厚度属性。
    • 自动更改行高以适应最大单元格的内容。

    其他功能

    • 可通过单元格与行实现完整的键盘导航。能将导航限制在只允许单元格或只允许行,或可以将导航禁用。
    • 支持多字段分类以及自定义标准分类。
    • 提供网格当前行的简单处理。
    • 可对任何单元格、行、组或列进行滚动浏览。
    • 当对网格进行滚动时,滚动提示能显示viewport中第一个可视行的信息。

    原文来自龙博方案网

    Xceed DataGrid for WPF

    Xceed DataGrid for WPF
    展开全文
  • Xceed DataGrid for WPF v3.5 Part.2
  • Xceed Toolkit Plus for WPF

    2022-05-19 21:10:21
    Xceed Toolkit Plus for WPF  Xceed Toolkit Plus for WPF 提供了每个 WPF 开发人员在构建应用程序 UI 过程中所需的基本控件、面板和主题。这些主题不仅适用于工具包的控件,还适用于所有基本 WPF 控件。  Xceed...

    Xceed Toolkit Plus for WPF

      Xceed Toolkit Plus for WPF 提供了每个 WPF 开发人员在构建应用程序 UI 过程中所需的基本控件、面板和主题。这些主题不仅适用于工具包的控件,还适用于所有基本 WPF 控件。

      Xceed Toolkit Plus for WPF 功能

      主要包含的控件

      AutoSelectTextBox:控件接收到焦点时选择谁的内容;当插入符号到达文本范围的末端时,还会执行自动焦点导航。

      BusyIndi​​cator:让用户知道应用程序何时正忙于执行操作,这样他们就不会认为它已冻结。

      ButtonSpinner:可以添加到任何元素的两按钮微调器控件。

      ByteUpDown:基于字节的数值上下控制。

      计算器:提供基本的数学函数、内存操作(清除、存储、调用、加法和减法)以及鼠标和键盘支持

      CalculatorUpDown:提供一个带有按钮微调器的 TextBox,允许通过单击按钮、键盘上/下箭头或鼠标滚轮来增加/减少数值,还提供一个 Calculator 下拉菜单,允许您执行数学计算。

     

      图表:一个 100% 无外观的图表控件,可显示丰富、可配置的图表,并能够同时显示多个区域和多个图表。支持面积图、柱形图、折线图和饼图,可以创建自定义图表。开发人员可以使用内置的灵活图例或提供自己的图例。

      CheckComboBox:一个组合框,其下拉项前面有一个复选框。

      CheckListBox:一个列表框控件,其项目前面有一个复选框。

      ChildWindow:一个模态内容控件,可以放置在视图的部分或其他内容控件之上,锁定其余部分。在特定父容器的边界范围内显示。v2.0 中的几个新属性允许设置窗口镶边样式,还允许调整大小和最大化(添加了最大化按钮)。

      CollectionControl:允许编辑集合。

      CollectionControlDialog:提供一个包含集合编辑器的对话框。

      ColorCanvas:提供滑块来控制 RGB 和 alpha 值的颜色编辑器。

      ColorPicker:使用 ColorCanvas 的颜色编辑器,还提供可用、标准和最近颜色的“调色板”。

      DataGrid:基于 Xceed DataGrid for WPF。提供同样流畅的用户体验,并使用异步数据虚拟化(有时称为“虚拟模式”或“延迟加载”)来大幅提高性能并减少内存使用以及许多其他功能。

      DateTimePicker:将日期和时间选择器组合到一个方便的控件中。

      DateTimeUpDown:允许用户通过鼠标/键盘增加/减少部分日期。非常适合空间有限的情况。

      DecimalUpDown:基于小数的数值上下控制。

      停靠窗口控件 (AvalonDock):允许开发人员使用类似于许多流行的集成开发环境 (IDE) 中的停靠系统来创建可自定义的布局。还支持托管 Windows 窗体控件。

      DoubleUpDown:基于双精度的数值上下控件。

      DropDownButton:一个按钮,单击时会显示一个下拉菜单,您可以在其中放置任何自定义内容。

      ExtendedTabControl:在单行中显示 TabItems 的选项卡控件,并提供用于滚动的右/左按钮和用于导航到特定 TabItem 的组合框。

      FilePicker:功能齐全的文件选择器文本框,允许最终用户选择一个或多个文件并以文本框格式查看所选文件。

    展开全文
  • wpf dataGrid 分组

    热门讨论 2013-05-03 17:08:40
    wpf dataGrid 分组,能展开与折叠
  • Xceed DataGrid for WPF v3.0 零售版
  • Xceed DataGrid for WPF v3.5 Part.1
  • 每一种不同的类型需要双击以后呈现不同的效果,本文通过使用Xceed.Wpf.DataGrid这个动态控件库来实现这个功能,当前使用的Dll版本是2.5.0.0,不同的版本可能实现上面有差别,这个在使用的时候需要特别注意。...

    背景
      在很多的时候我们需要编辑DataGrid中每一个Cell,编辑后保存数据,原生的WPF中的DataGrid并没有提供这样的功能,今天通过一个具体的例子来实现这一个功能,在这个例子中DataGrid中的数据类型可能是多种多样的,有枚举、浮点类型、布尔类型、DateTime类型,每一种不同的类型需要双击以后呈现不同的效果,本文通过使用Xceed.Wpf.DataGrid这个动态控件库来实现这个功能,当前使用的Dll版本是2.5.0.0,不同的版本可能实现上面有差别,这个在使用的时候需要特别注意。

    Demo预览

    在这里插入图片描述

    代码结构
      代码还是按照常规的MVVM结构来进行编写,主要包括Views、Models、MainWindowViewModel、Converters这些常规的结构,在介绍这些之前来说一下我们的整体结构,在Demo中我们准备了一个四行三列的DataGrid,其中第一列主要是表示当前行的名称、后面的Step列是根据代码动态进行添加的,这个Step部分是我们通过代码动态调整的,调整完成后能够将数据保存到数据源中,我们还是按照MVVM的结构来进行进行代码的介绍。

    1 MainWindow

    <Window x:Class="DataGridCellDoubleClickDemo.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:xceed="http://schemas.xceed.com/wpf/xaml/datagrid"
            xmlns:models="clr-namespace:DataGridCellDoubleClickDemo.Models"
            xmlns:views="clr-namespace:DataGridCellDoubleClickDemo.Views"
            mc:Ignorable="d"
            Title="DataGridDemo" Height="450" Width="800">
        <Window.Resources>
            <DataTemplate x:Key="CustomTemplate">
                <Border BorderThickness="1" BorderBrush="Blue">
                    <TextBlock Text="{Binding Path=Display }"  FontWeight="Bold"
                               HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                </Border>
            </DataTemplate>
            <DataTemplate x:Key="RowHeadTemplate" DataType="{x:Type models:RecipeControlVariable}">
                <TextBlock Text="{Binding DisplayName}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="Black" FontSize="12"/>
            </DataTemplate>
            <xceed:DataGridCollectionViewSource x:Key="recipeData" Source="{Binding RecipeVariables}"></xceed:DataGridCollectionViewSource>
        </Window.Resources>
        <Grid>
            <xceed:DataGridControl x:Name="DataGridControl"
                                   AutoCreateColumns="False"
                                   FontSize="13"
                                   VerticalContentAlignment="Center"
                                   BorderBrush="Gray"
                                   BorderThickness="1"
                                   ItemsPrimaryAxis="Horizontal"
                                   PagingBehavior="LeftToRight"
                                   UpdateSourceTrigger="CellContentChanged"
                                   SelectionUnit="Cell"
                                   SelectionMode="Single"                              
                                   ItemsSource="{Binding  Source={StaticResource recipeData}}">
                <xceed:DataGridControl.View>
                    <xceed:TableflowView FixedColumnCount="1" ContainerHeight="30" x:Name="tblView"
                                            VerticalGridLineThickness="0.5" HorizontalGridLineBrush="Gray"
                                            HorizontalGridLineThickness="1" VerticalGridLineBrush="Black"
                                            RowFadeInAnimationDuration="0"
                                            ScrollingAnimationDuration="0" ColumnStretchMinWidth="10"
                                            DetailIndicatorWidth="20" ShowRowSelectorPane="False"
                                            ShowScrollTip="False" UseDefaultHeadersFooters="False">
                        <xceed:TableflowView.FixedHeaders>
                            <DataTemplate>
                                <xceed:ColumnManagerRow AllowColumnReorder="False" AllowColumnResize="True" AllowDrop="False" AllowSort="False" />
                            </DataTemplate>
                        </xceed:TableflowView.FixedHeaders>
                    </xceed:TableflowView>
                </xceed:DataGridControl.View>
      
                <xceed:DataGridControl.DefaultCellEditors>
                    <xceed:CellEditor x:Key="{x:Type models:SmartCellViewModel}">
                        <xceed:CellEditor.EditTemplate>
                            <DataTemplate>
                                <views:SmartCellEditor Content="{xceed:CellEditorBinding}"  VerticalAlignment="Center"
                                                       Height="{Binding ActualHeight,RelativeSource={RelativeSource AncestorType={x:Type Border},AncestorLevel=1}}"></views:SmartCellEditor>
                            </DataTemplate>
                        </xceed:CellEditor.EditTemplate>
                    </xceed:CellEditor>
                </xceed:DataGridControl.DefaultCellEditors>
      
            </xceed:DataGridControl>
        </Grid>
    </Window>
    

    在View部分主要是通过引用Xceed中的DataGridControl控件进行扩展的,这个里面主要是需要设置DataGridControl的View和DefaultCellEditor这个里面DefaultCellEditor是本文的重点,这个就是单元格Cell双击后进行编辑的主体,在这个里面我们需要指定CellEditor的EditTemplate,这里面需要匹配一个DataTemplate,这个里面是一个SmartCellEditor的子View,下面我们来看看这个SmartCellEditor里面是什么内容?

    2 SmartCellEditor

    <UserControl x:Class="DataGridCellDoubleClickDemo.Views.SmartCellEditor"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:conv="clr-namespace:DataGridCellDoubleClickDemo.Converters"
                 xmlns:xceed="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
                 mc:Ignorable="d"
                 d:DesignHeight="450" d:DesignWidth="800">
        <UserControl.Resources>
            <conv:VisibilityConverter x:Key="visConverter" />
            <conv:TimeSpanConverter x:Key="timeSpanConverter" />
            <conv:NumConverter x:Key="numConverter" />
            <conv:BoolConverter x:Key="boolConverter" />
        </UserControl.Resources>
      
        <StackPanel Margin="0">
            <!--TextBlock-->
            <TextBlock x:Name="textBlock"
                       Background="{Binding Background}"
                       Foreground="{Binding Foreground}"
                       Text="{Binding Path=Display,Mode=OneWay}" 
                       ToolTip="{Binding ToolTip}"
                       FontWeight="{Binding FontWeight}"
                       VerticalAlignment="Stretch" 
                       Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=TextBlock}"/>
      
      
            <!--Editable ComboBox-->
            <ComboBox x:Name="editableComboBox" ItemsSource="{Binding SmartCellData.Selections}" IsEditable="True"  VerticalAlignment="Stretch" VerticalContentAlignment="Center"
                      DisplayMemberPath="SelectionDisplayName" Text="{Binding CellValue,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                      Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=EditableComboBox}" />
      
            <!--Readonly ComboBox-->
            <ComboBox x:Name="readonlyComboBox"  VerticalAlignment="Center" VerticalContentAlignment="Stretch"  ItemsSource="{Binding SmartCellData.Selections}" IsEditable="False"
                      DisplayMemberPath="SelectionDisplayName" SelectedValuePath="ControlName" SelectedValue="{Binding Path=CellValue,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                      Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=ReadonlyComboBox}" />
      
      
            <!--Text Input TextBox-->
            <TextBox HorizontalContentAlignment="Left"  VerticalAlignment="Stretch" VerticalContentAlignment="Center" Text="{Binding CellValue}"
                     Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=TextBox}" TextAlignment="Left" />
      
      
            <!--Number Input TextBox-->
            <xceed:DecimalUpDown HorizontalContentAlignment="Left"  VerticalAlignment="Stretch" VerticalContentAlignment="Center"  FormatString="G" Value="{Binding Path=CellValue,Converter={StaticResource numConverter},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                 Increment="1" Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=DecimalUpDown}" TextAlignment="Left" />
      
      
            <!--CheckBox-->
            <CheckBox x:Name="checkBox"  VerticalAlignment="Stretch" VerticalContentAlignment="Center"  Content="{Binding Tag}" IsChecked="{Binding Path=CellValue,Converter={StaticResource boolConverter},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                      Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=CheckBox}" />
      
      
            <!--TimePicker-->
            <xceed:DateTimeUpDown Format="Custom" FormatString="HH:mm:ss"  VerticalAlignment="Stretch" VerticalContentAlignment="Center"  Value="{Binding Path=CellValue,Converter={StaticResource timeSpanConverter},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                  Visibility="{Binding Path=., Converter={StaticResource visConverter},ConverterParameter=TimePicker}" CultureInfo="uk-UA" />
      
        </StackPanel>
    </UserControl>
    

    在这个里面我们在一个StackPanel中放置了匹配各种数据类型的Template,并且每一个的Visibility都是由visConverter这个自定义的Converter来实现的,后面我们会分析这个Converter里面的内容,这些代码的整体思想就是每次这个StackPanel里面的Template都只有一个可以显示,其它的都是隐藏的,哪一个会显示是根据当前的数据类型决定的,每一个注释表示每一个类型的数据,比如我们如果定义的是Bool类型,那么当我们双击单元格Cell的时候会出现一个CheckBox供我们编辑,所以这个里面我们需要根据我们定义的数据类型来扩展对应的模板,当我们双击单元格的时候就会显示这个模板从而进行编辑数据。

    3 MainWindowViewModel
    这个里面是定义的MainWindow对应的DataContext,在这里面我们会初始化绑定到MainWindow中DataGridControl的ItemsSource,我们先来看看这个里面核心的代码并就其中的要点进行分析。

    using DataGridCellDoubleClickDemo.Models;
    using System;
    using System.Collections.ObjectModel;
    using System.Windows;
      
    namespace DataGridCellDoubleClickDemo
    {
        public class MainWindowViewModel : NotificationObject
        {
            public MainWindowViewModel(Xceed.Wpf.DataGrid.DataGridControl dataGridControl)
            {
                DataGridControl = dataGridControl;
                InitRecipeVariables();
            }
      
      
            #region Properties
            private ObservableCollection<RecipeControlVariable> _RecipeVariables = new ObservableCollection<RecipeControlVariable>();
      
            public ObservableCollection<RecipeControlVariable> RecipeVariables
            {
                get { return _RecipeVariables; }
                set
                {
                    if (value != _RecipeVariables)
                    {
                        _RecipeVariables = value;
                        OnPropertyChanged(nameof(RecipeVariables));
                    }
      
                }
            }
      
            public Xceed.Wpf.DataGrid.DataGridControl DataGridControl { get; set; }
      
            #endregion
      
            #region Private Methods
            private void InitRecipeVariables()
            {
                _RecipeVariables.Add(new RecipeControlVariable
                {
                    ControlName = "Name",
                    DisplayName = "Name",
                    StepValues = new ObservableCollection<SmartCellViewModel>
                    {
                        new SmartCellViewModel
                        {
                            CellValue="Step",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "Name",
                                 DisplayName = "Name",
                                 VariableEditorType=RecipeVariableEditorType.TextInput
                            }
                        },
                        new SmartCellViewModel
                        {
                            CellValue="Step",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "Name",
                                 DisplayName = "Name",
                                 VariableEditorType=RecipeVariableEditorType.TextInput
                            }
                        }
                    }
      
                });
                _RecipeVariables.Add(new RecipeControlVariable
                {
                    ControlName = "Time",
                    DisplayName = "Process Time(Sec)",
                    StepValues = new ObservableCollection<SmartCellViewModel>
                    {
                        new SmartCellViewModel
                        {
                            CellValue="0",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "Time",
                                 DisplayName = "Process Time(Sec)",
                                 VariableEditorType=RecipeVariableEditorType.NumInput
                            }
                        },
                        new SmartCellViewModel
                        {
                            CellValue="0",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "Time",
                                 DisplayName = "Process Time(Sec)",
                                 VariableEditorType=RecipeVariableEditorType.NumInput
                            }
                        }
                    }
      
                });
                _RecipeVariables.Add(new RecipeControlVariable
                {
                    ControlName = "FrontChemical",
                    DisplayName = "FrontChemical",
                    StepValues = new ObservableCollection<SmartCellViewModel>
                    {
                        new SmartCellViewModel
                        {
                            CellValue="None",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "FrontChemical",
                                 DisplayName = "FrontChemical",
                                 VariableEditorType=RecipeVariableEditorType.ReadOnlySelection,
                                 Selections=new ObservableCollection<SelectionItem>
                                 {
                                     new SelectionItem
                                     {
                                         SelectionControlName="CHEM1",
                                         SelectionDisplayName="CHEM1",
                                     },
                                     new SelectionItem
                                     {
                                         SelectionControlName="N2",
                                         SelectionDisplayName="N2",
                                     },
                                     new SelectionItem
                                     {
                                         SelectionControlName="CDIW",
                                         SelectionDisplayName="CDIW",
                                     },
                                     new SelectionItem
                                     {
                                         SelectionControlName="",
                                         SelectionDisplayName="None",
                                     }
                                 }
                            }
                        },
                        new SmartCellViewModel
                        {
                            CellValue="None",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "FrontChemical",
                                 DisplayName = "FrontChemical",
                                 VariableEditorType=RecipeVariableEditorType.ReadOnlySelection,
                                 Selections=new ObservableCollection<SelectionItem>
                                 {
                                     new SelectionItem
                                     {
                                         SelectionControlName="CHEM1",
                                         SelectionDisplayName="CHEM1",
                                     },
                                     new SelectionItem
                                     {
                                         SelectionControlName="N2",
                                         SelectionDisplayName="N2",
                                     },
                                     new SelectionItem
                                     {
                                         SelectionControlName="CDIW",
                                         SelectionDisplayName="CDIW",
                                     },
                                     new SelectionItem
                                     {
                                         SelectionControlName="",
                                         SelectionDisplayName="None",
                                     }
                                 }
                            }
                        }
                    }
      
                });
                _RecipeVariables.Add(new RecipeControlVariable
                {
                    ControlName = "NozzleBindingSetting",
                    DisplayName = "Nozzle Scan",
                    StepValues = new ObservableCollection<SmartCellViewModel>
                    {
                        new SmartCellViewModel
                        {
                            CellValue="Default",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "NozzleBindingSetting",
                                 DisplayName = "Nozzle Scan",
                                 VariableEditorType=RecipeVariableEditorType.TextInput
                            }
                        },
                        new SmartCellViewModel
                        {
                            CellValue="Default",
                            ErrorInfo=null,
                            SmartCellData=new RecipeVariableItem
                            {
                                 ControlName = "NozzleBindingSetting",
                                 DisplayName = "Nozzle Scan",
                                 VariableEditorType=RecipeVariableEditorType.TextInput
                            }
                        }
                    }
      
                });
            }
            #endregion
      
            /// <summary>
            /// reload datagrid content
            /// </summary>
            public void RefreshDataGrid()
            {
                try
                {
                    if (null == DataGridControl) return;
                    //generate columns in Grid
                    DataGridControl.CurrentColumn = null;
                    if (DataGridControl.Columns.Count > 0)
                        DataGridControl.Columns.Clear();
      
                    var template = (DataTemplate)this.DataGridControl.FindResource("CustomTemplate");
                    var rowTemplate = (DataTemplate)this.DataGridControl.FindResource("RowHeadTemplate");
      
                    DataGridControl.Columns.Add(new Xceed.Wpf.DataGrid.Column()
                    {
                        Width = 140,
                        Title = "Name",
                        FieldName = ".",
                        CellContentTemplate = rowTemplate
                    });
      
                    var cellEditor = DataGridControl.DefaultCellEditors[typeof(SmartCellViewModel)];
      
                    for (int index = 0; index < RecipeVariables[0].StepValues.Count; index++)
                    {
                        int width = 1;
                        for (int n = 0; n < RecipeVariables.Count; n++)
                        {
                            string display = RecipeVariables[n].StepValues[index].Display;
                            if (!string.IsNullOrWhiteSpace(display))
                            {
                                int temp = display.Length * 7;
                                width = Math.Max(temp, width);
                            }
                        }
                        width = (int)(width * 1.1);
                        width = Math.Max(width, 80);
                        DataGridControl.Columns.Add(new Xceed.Wpf.DataGrid.Column()
                        {
      
                            Title = string.Format("Step {0}", index + 1),
                            FieldName = string.Format("StepValues[{0}]", index),
                            CellContentTemplate = template,
                            AllowSort = false,
                            Width = width,
                            MaxWidth = width * 2,
                            CellEditor = cellEditor
                        });
                    }
      
                }
                catch (Exception ex)
                {
      
                }
    

    在这个里面我们重点分析下RefreshDataGrid这个子函数,在我们的MainWindowViewModel中我们定义的RecipeVariables是最终绑定到MainWindow中定义的DataGridControl中的ItemsSource,是整个控件的数据源,由于我们这个DataGird的第一列和后面的Step列数据类型不同,所以我们的RefreshDataGrid函数中增加Column列的时候是分作两个部分,第一个部分是单独增加一列,后面的列是通过循环StepValues这个集合来动态进行增加的,代码中我们定义了多少个StepValue,那么后面就会有多少列,这个里面的重点是增加Column的时候FieldName的赋值,这个是十分关键的,这个关系到能够让每一列获取到正确的数据源,例如第一列赋值Filed= “.” 表示直接从当前绑定的数据源获取数据,另外后面的Step列的每一个FieldName是动c#教程态进行赋值的,赋值语句是:FieldName = string.Format(“StepValues[{0}]”, index),这个里面Index是一个动态值,这个是非常关键的一步,另外后面的Step列由于需要通过双击进行编辑所以每一个Column是需要赋值CellEditor对象的,另外这个ViewModel中的DataGridControl是通过构造函数进行赋值的,构造函数中的赋值就是MainWindow中定义的DataGridControl对象,这个在阅读代码时需要特别注意。

    4 Models
    Models主要是定义的数据集合,我们的代码中主要包括RecipeControlVariable和SmartViewModel这两个部分,这两个部分分别对应DataGridControl的数据源以及双击进行编辑的SmartCellEditor两个部分一一对应。

    更多代码方面的细节需要仔细去分析阅读源码,需要源码请点击此处进行下载。

    以上就是c# WPF中通过双击编辑DataGrid中Cell的示例(附源码)的详细内容

    展开全文
  • Also includes the advanced features of Xceed DataGrid for WPF Professional Edition and the world’s first commercially available control for Silverlight 3, Xceed Upload for Silverlight, as well as ...
  • Also includes the advanced features of Xceed DataGrid for WPF Professional Edition and the world’s first commercially available control for Silverlight 3, Xceed Upload for Silverlight, as well as ...
  • Also includes the advanced features of Xceed DataGrid for WPF Professional Edition and the world’s first commercially available control for Silverlight 3, Xceed Upload for Silverlight, as well as ...
  • Also includes the advanced features of Xceed DataGrid for WPF Professional Edition and the world’s first commercially available control for Silverlight 3, Xceed Upload for Silverlight, as well as ...
  • Also includes the advanced features of Xceed DataGrid for WPF Professional Edition and the world’s first commercially available control for Silverlight 3, Xceed Upload for Silverlight, as well as ...
  • Xceed Datagrid for Wpf中带有可编辑combox项做法实例(并且关联外键)。首先前台xaml中显示字段中需要加CellContentTemplate,CellEditor两个属性并对这两个属性编辑相应的...<Window x:Class="Xceed.Wpf.DataGrid.F
  • Xceed Professional Themes for WPF是一款为你的整个应用程序提供完美WPF主题风格的控件,包含Office 2007和Windows 7,可以应用到任何微软官方的WPF控件。 具体功能: WPF/.NET技术: 完全基于WPF创建,由C#和...
  • Xceed DataGrid for WPF 1.3 Xceed Docking Windows for .NET 2.0 Xceed Editors for .NET 2.3 Xceed Encryption Library 1.1 Xceed FTP for .NET 3.6 Xceed FTP for .NET Compact Framework 3.6 Xceed FTP Library ...
  • 我使用的是Xceed 控件,对此控件不是很熟悉,在网上查询了下, 用此段代码可以实现。                   功能实现了 ,可是 样式全变化了,估计用户接受不了。所以我就换成了VS1012自带的...
  • WPF 小记

    2020-08-27 10:50:50
    PropertyGrid的使用 nuget下载extended wpf toolkit,xaml调用 xmlns:extoolkit="http://schemas.xceed.com/wpf/xaml/toolkit"  cs调用 public class TestPropertyGrid { [Category("MyProperty")] public int ...
  • Xceed Ultimate Suite 2021.3

    2022-01-26 18:02:36
    Xceed Ultimate Suite 包含 160 多个适用于所有 Windows 平台的自适应、可靠和高性能控件和库的重要集合。程序前端的 UI 控件和后端的数据处理库。...106 个 WPF 控制器,例如用于 WPFXceed DataGrid
  • 验证说起来也不复杂,在对应的列中添加和列名中的fileName一样">> />xcdg:DataGridBindingInfo.ValidationRules> 这样的属性并在YearValidationRule中写相应的验证代码即可。...<Window x:Class="Datagrid.Validatin
  • Xceed Ultimate Suite 2022.2

    2022-05-28 23:17:04
    Xceed Ultimate Suite 包含 160 多个适用于所有 Windows 平台的自适应、可靠和高性能控件和库的重要集合。程序前端的 UI 控件和后端的数据处理库。...106 个 WPF 控制器,例如用于 WPFXceed DataGri.
  • Xceed DataGrid 中设置增加行的方法

    千次阅读 2013-04-12 21:59:57
    废话不多说直接贴代码: ...<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid" xmlns:local="clr-namespace:Xceed.Wpf.Documentation"> <xcdg:DataGridCollectionViewSource x:Key="cvs_persons"
  • wpf 输入字符长度限制

    千次阅读 2017-02-23 14:15:56
    wpf里很多控件比如像textbox,就存在Maxlength...件,C1Felxgrid,Xceed.Wpf.DataGrid.DataGridControl这些控件的cell内,也需要限制 长度的时候就傻眼了。不可能这么多控件都去一一研究他们怎么控制。搞半天,也很...
  • 这个控件库主要目标是用于教学,希望通过这些博客初学者可以学会为自己或公司创建自定义控件,并且对WPF有更深入的了解。 控件库已放在Github上,并且也以发布到NuGet。 现阶段我的目标是实现一些简单的控件,由于...
  • 4,MVVM思想二·下面我用一个可编辑数据的DataGrid作为示范: 1. 首先,我们在xaml中创建一个DataGrid控件,控件的的数据源绑定在ViewModel中&lt;Window x:Name="window" x:Class="MainWindow&...
  • WPF 实践

    2021-05-08 08:59:10
    一 ,基础 1.1 WPF如何实现绘制的 WPF绘制的数据结构 使用XAML文件描绘WPF应用程序界面时,其组织结构从根节点自顶而下看起来像一棵树,称为“逻辑树”(Logic Tree) 从绘制的角度分析WPF体系 一个WPF应用程序从两...
  • WPF随笔(十)--使用AvalonDock实现可停靠式布局

    千次阅读 多人点赞 2019-01-22 22:37:18
    除了AvalonDock,Extended.Wpf.Toolkit套件中还包含了Xceed.Wpf.DataGridXceed.Wpf.Toolkit,有兴趣的 也可以了解下。 代码示例 < avalon: DockingManager > < avalon: DockingManager.Theme > < ...

空空如也

空空如也

1 2 3 4 5
收藏数 85
精华内容 34
关键字:

xceed.wpf.datagrid