Skip to main content

GridDashboardLayoutItem Class

Allows you to specify the style and templates to customize the GridDashboardItem appearance.

Namespace: DevExpress.DashboardWpf

Assembly: DevExpress.Xpf.Dashboard.v24.2.dll

Declaration

public class GridDashboardLayoutItem :
    DashboardLayoutItem

Remarks

When you create a custom GridDashboardLayoutItem template, bind the DashboardLayoutItem.ViewStyle property to the Style property of the underlying Grid control or bind the following styles to the underlying control’s objects:

The following code snippet shows how to pin Grid columns to the left:

<Window
    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:dxdash="http://schemas.devexpress.com/winfx/2008/xaml/dashboard" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
    mc:Ignorable="d"
    Title="MainWindow" Height="450" Width="800">
  <Window.Resources>

  <!--Create the template to enable the BaseColumn.Fixed property.-->
    <DataTemplate x:Key="gridTemplate">
        <dxg:GridControl Style="{Binding Path=(dxdash:DashboardLayoutItem.ViewStyle), RelativeSource={RelativeSource TemplatedParent}}" >
            <dxg:GridControl.ColumnGeneratorTemplate>
                <DataTemplate>
                    <dxg:GridColumn Style="{Binding Path=(dxdash:GridDashboardLayoutItem.ColumnStyle), RelativeSource={RelativeSource Self}}">
                        <dxg:GridColumn.Fixed>
                            <dxg:FixedStyle>Left</dxg:FixedStyle>
                        </dxg:GridColumn.Fixed>
                    </dxg:GridColumn>
                </DataTemplate>
            </dxg:GridControl.ColumnGeneratorTemplate>
        </dxg:GridControl>
    </DataTemplate>
  </Window.Resources>

  <Grid>
    <dxdash:DashboardControl Grid.Column="0"  x:Name="dashboardControl1" 
                              DashboardSource="../../Dashboards/dashboard1.xml" 
                              BorderThickness="3" >
        <!--Apply the template to the Grid dashboard item.-->                           
        <dxdash:DashboardControl.GridItemStyle>
            <Style TargetType="dxdash:GridDashboardLayoutItem">
                <Setter Property="ContentTemplate" Value="{StaticResource gridTemplate}" />
            </Style>
        </dxdash:DashboardControl.GridItemStyle>
    </dxdash:DashboardControl>
  </Grid>
</Window>

To correctly render Grid’s fixed columns, set the GridOptions.ColumnWidthMode property to AutoFitToContents

Tip

For a complete list of dashboard item styles, see A List of Styles and Templates.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GridDashboardLayoutItem class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

See Also