EnhancedListView ClassDW.WPFToolkit Documentation
Enhances the ListView with additional features like column sorting, dynamic column width and dynamic shown column.
Inheritance Hierarchy

SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.Windows.MediaVisual
        System.WindowsUIElement
          System.WindowsFrameworkElement
            System.Windows.ControlsControl
              System.Windows.ControlsItemsControl
                System.Windows.Controls.PrimitivesSelector
                  System.Windows.ControlsListBox
                    System.Windows.ControlsListView
                      DW.WPFToolkit.ControlsEnhancedListView

Namespace: DW.WPFToolkit.Controls
Assembly: DW.WPFToolkit (in DW.WPFToolkit.dll) Version: 5.6.0.0
Syntax

C#
public class EnhancedListView : ListView

The EnhancedListView type exposes the following members.

Constructors

  NameDescription
Public methodEnhancedListView
Initializes a new instance of the EnhancedListView class
Top
Fields

  NameDescription
Public fieldStatic memberAllowColumnSortingsProperty
Identifies the AllowColumnSortings dependency property.
Public fieldStatic memberAscendingSortHeaderTemplateProperty
Identifies the AscendingSortHeaderTemplate dependency property.
Public fieldStatic memberAutoSizeProperty
Identifies the AutoSize dependency property.
Public fieldStatic memberDescendingSortHeaderTemplateProperty
Identifies the DescendingSortHeaderTemplate dependency property.
Public fieldStatic memberNeutralHeaderTemplateProperty
Identifies the NeutralHeaderTemplate dependency property.
Public fieldStatic memberTemplatePaddingWidthFixProperty
Identifies the TemplatePaddingWidthFix dependency property.
Public fieldStatic memberVisibleColumnsProperty
Identifies the VisibleColumns dependency property.
Top
Properties

  NameDescription
Public propertyAllowColumnSortings
Gets or sets a value which indicates of sorting by clicking on the header is enabled or not. To have this functionality the SortPropertyName has to be set in the columns. For display arrows to indicate the sort direction consider setting header templates.
Public propertyAscendingSortHeaderTemplate
Gets or sets the header template to be used if AllowColumnSortings is set to true and the items are sorted by a column in an ascending order.
Public propertyAutoSize
Gets or sets a value which indicates how the columns should be resized. Columns which width is set will not modified.
Public propertyDescendingSortHeaderTemplate
Gets or sets the header template to be used if AllowColumnSortings is set to true and the items are sorted by a column in an descending order.
Public propertyNeutralHeaderTemplate
Gets or sets the header template to be used if AllowColumnSortings is set to true and the items are not sorted by a column.
Public propertyTemplatePaddingWidthFix
Gets or sets additional distance on the right for the sum of all column width if the width is calculated.
Public propertyVisibleColumns
Gets or sets a collection of columns which should be visible by their name.
Top
Examples

XAML
<DataTemplate x:Key="HeaderArrowUp">
    <Grid>
        <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center" />
        <Path StrokeThickness="0" SnapsToDevicePixels="True" Data="M 0,4 L 4,0 L 8,4 L 0,4"
              Margin="0,-2,0,0" VerticalAlignment="Top" HorizontalAlignment="Center">
            <Path.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="#FF3C5E72" Offset="0"/>
                    <GradientStop Color="#FFC3E4F5" Offset="1"/>
                </LinearGradientBrush>
            </Path.Fill>
        </Path>
    </Grid>
</DataTemplate>
<DataTemplate x:Key="HeaderArrowDown">
    <Grid>
        <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center" />
        <Path StrokeThickness="0" SnapsToDevicePixels="True" Data="M 0,0 L 4,4 L 8,0 L 0,0"
              Margin="0,-2,0,0" VerticalAlignment="Top" HorizontalAlignment="Center">
            <Path.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="#FF3C5E72" Offset="0"/>
                    <GradientStop Color="#FFC4E3F4" Offset="1"/>
                </LinearGradientBrush>
            </Path.Fill>
        </Path>
    </Grid>
</DataTemplate>
<DataTemplate x:Key="HeaderTransparent">
    <Grid>
        <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center" />
    </Grid>
</DataTemplate>

<WPFToolkit:EnhancedListView AllowColumnSortings="True"
                             AscendingSortHeaderTemplate="{StaticResource HeaderArrowUp}"
                             DescendingSortHeaderTemplate="{StaticResource HeaderArrowDown}"
                             NeutralHeaderTemplate="{StaticResource HeaderTransparent}"

                             VisibleColumns="{Binding VisibleColumnNames}"

                             AutoSize="Proportional"
                             >
    <ListView.View>
        <GridView>
            <WPFToolkit:EnhancedGridViewColumn SortPropertyName="Name" IsDefaultSortColumn="True" Name="Name" ProportionalWidth="60" />
            <WPFToolkit:EnhancedGridViewColumn SortPropertyName="Size" Name="Size" ProportionalWidth="30" />
            <WPFToolkit:EnhancedGridViewColumn SortPropertyName="Date" Name="Date" ProportionalWidth="10" />
        </GridView>
    </ListView.View>
</WPFToolkit:EnhancedListView>
See Also

Reference