xceed wpf datagrid
<!--*********************************************************************************** Extended WPF Toolkit Copyright (C) - 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=""
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=""
Width="">
<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 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=""
Grid.ColumnSpan=""
views:TableView.CanScrollHorizontally="False"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" /> <local:HierarchicalGroupLevelIndicatorPane Grid.Column=""
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="" /> <!-- ToggleButton that is used to expand/collapse the group. -->
<Button x:Name="detailsToggle"
Template="{StaticResource detailsExpanderButtonTemplate}"
VerticalAlignment="Top"
Grid.Column=""
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=""
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=""
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 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=""
Grid.ColumnSpan=""
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=""
Background="{TemplateBinding Background}" />
<local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
views:TableView.CanScrollHorizontally="False"
Grid.Column=""
Background="{TemplateBinding Background}" /> <!-- ToggleButton that is used to expand/collapse the group. -->
<Button x:Name="detailsToggle"
Template="{StaticResource detailsExpanderButtonTemplate}"
VerticalAlignment="Top"
Grid.Column=""
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=""> <!-- 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=""
Margin="0,2,0,2" /> <Rectangle Fill="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
Width=""
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=""
HorizontalAlignment="Left" /> <!-- Thumb that is used to resize the Column. -->
<Thumb x:Name="PART_ColumnResizerThumb"
Style="{StaticResource invisibleThumbStyle}"
Width=""
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="" />
</Trigger> <Trigger Property="IsPressed"
Value="True"> <Setter TargetName="contentPanel"
Property="Margin"
Value="1,1,-1,-1" /> </Trigger> <!-- The following 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 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="" /> <Condition Property="IsLeaf"
Value="False" /> </MultiTrigger.Conditions> <Setter TargetName="verticalBorder"
Property="BorderThickness"
Value="" /> </MultiTrigger> <Trigger Property="ShowVerticalBorder"
Value="False">
<Setter TargetName="verticalBorder"
Property="BorderThickness"
Value="" />
</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="" />
<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=""> <!--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=""
Grid.Row=""
Grid.ColumnSpan="" />
</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 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=""
Grid.ColumnSpan=""
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=""
Grid.ColumnSpan=""
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="" /> <!-- 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="" /> <StackPanel Grid.Column=""
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 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=""
Grid.ColumnSpan=""
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=""
Grid.ColumnSpan=""
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="" /> <!-- 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="" /> <local:GroupByControl Grid.Column=""
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="" /> <Setter TargetName="outerBorder"
Property="Padding"
Value="" /> <Setter TargetName="innerBorder"
Property="BorderThickness"
Value="" /> <Setter TargetName="innerBorder"
Property="Margin"
Value="" /> <Setter TargetName="contentPanel"
Property="Margin"
Value="1,1,-1,-1" /> </Trigger> <!-- The following 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>
xceed wpf datagrid的更多相关文章
- WPF DataGrid常用属性记录
WPF DataGrid常用属性记录 组件常用方法: BeginEdit:使DataGrid进入编辑状态. CancelEdit:取消DataGrid的编辑状态. CollapseRowGroup:闭 ...
- WPF DATAGRID - COMMITTING CHANGES CELL-BY-CELL
In my recent codeproject article on the DataGrid I described a number of techniques for handling the ...
- WPF DataGrid某列使用多绑定后该列排序失效,列上加入 SortMemberPath 设置即可.
WPF DataGrid某列使用多绑定后该列排序失效 2011-07-14 10:59hdongq | 浏览 1031 次 悬赏:20 在wpf的datagrid中某一列使用了多绑定,但是该列排序失 ...
- 获取wpf datagrid当前被编辑单元格的内容
原文 获取wpf datagrid当前被编辑单元格的内容 确认修改单元个的值, 使用到datagrid的两个事件 开始编辑事件 BeginningEdit="dataGrid_Beginni ...
- WPF DataGrid绑定一个组合列
WPF DataGrid绑定一个组合列 前台: <Page.Resources> <local:InfoConverter x:Key="converter& ...
- WPF DataGrid自定义样式
微软的WPF DataGrid中有很多的属性和样式,你可以调整,以寻找合适的(如果你是一名设计师).下面,找到我的小抄造型的网格.它不是100%全面,但它可以让你走得很远,有一些非常有用的技巧和陷阱. ...
- WPF DataGrid显格式
Guide to WPF DataGrid formatting using bindings Peter Huber SG, 25 Nov 2013 CPOL 4.83 (13 votes) ...
- WPF DataGrid Custommization using Style and Template
WPF DataGrid Custommization using Style and Template 代码下载:http://download.csdn.net/detail/wujicai/81 ...
- 编写 WPF DataGrid 列模板,实现更好的用户体验
Julie Lerman 下载代码示例 最近我在为一个客户做一些 Windows Presentation Foundation (WPF) 方面的工作. 虽然我提倡使用第三方工具,但有时也会避免使用 ...
随机推荐
- Unicode(UTF-8, UTF-16)令人混淆的概念
为啥需要Unicode 我们知道计算机其实挺笨的,它只认识0101这样的字符串,当然了我们看这样的01串时肯定会比较头晕的,所以很多时候为了描述简单都用十进制,十六进制,八进制表示.实际上都是等价的, ...
- R语言 数据的输入方式总结
1.使用C函数连接数据 2.使用c,cbind,rbind结合变量 3.使用Vector函数结合数据 4.使用矩阵结合数据5.使用data.frame函数结合数据 6.使用list函数结合数据 c 向 ...
- bzoj2131
首先不难想到对t排序,有f[i]=max(f[j])+v[i] tj<=ti且abs(pi-pj)/2<=ti-tj;要想优化,肯定从优化转移入手先去绝对值,当pi>=pj时,可得2 ...
- Maven学习(3) - Maven和Eclipse集成和构建多模块Maven项目
最近在工作中越来越经常的用到了Maven作为项目管理和Jar包管理和构建的工具,感觉Maven的确是很好用的.而且要将Maven的功能最大发挥出来,多模块是一个很好的集成例子. 一个Maven项目包括 ...
- Linux学习笔记21——线程同步的两种方式
一 用信号量同步 1 信号量函数的名字都以sem_开头,线程中使用的基本信号量函数有4个 2 创建信号量 #include<semaphore.h> int sem_init(sem_t ...
- HDOJ1181变形课 深搜回溯
变形课 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submissi ...
- vijosP1071 新年趣事之打牌
vijosP1071 新年趣事之打牌 链接:https://vijos.org/p/1071 [思路] 01背包+路径输出. 用d[][]记录[][]可转移的数目,>=2则输出-1,0输出0,否 ...
- 折腾iPhone的生活——我的越狱插件精品筛选
威锋上有人说的好,iOS系统越狱是为了装更多东西,安卓Root是为了删更多东西. 插件 众所周知,iOS系统是非常封闭的,基本上涉及到底层的功能在iOS上都不能实现,除非越狱装插件,所以插件就成为 ...
- 【原】centos6.5下cdh4.6 Oozie安装
0.oozie只需安装在一台服务器上,这里选择在namenode上来安装:安装用户为cloud-user 1.安装Oozie包: sudo yum install -y oozie oozie- ...
- 《University Calculus》-chape12-偏导数-基本概念
偏导数本质上就是一元微分学向多元函数的推广. 关于定义域的开域.闭域的推广: 其实这个定义本质上讲的就是xoy面上阴影区域的最外面的一周,只不过这里用了更加规范的数学语言. 二次函数的图形.层曲线(等 ...