To provide any text for the RowIndicator, override the DataTemplate for IconPresenterTemplate resource key. If it's necessary to assign the data source row index, create an unbound column, and bind an element in the template to this unbound column.
-
This no longer works in 2010.2 as the schema location has changed.
You need to add
xmlns:dxt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"and replace any dxg:RowIndicatorThemeKey in the xaml with dxt:RowIndicatorThemeKey
Also add IsThemeIndependant=True if you aren't using their themes.
<DataTemplate x:Key="{dxt:RowIndicatorThemeKey ResourceKey=IconPresenterTemplate, IsThemeIndependent=true}">
<Window x:Class="Q266716RowIndicator.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
Title="Window1" Height="300" Width="300">
<dxg:GridControl x:Name="gridControl" CustomUnboundColumnData="GridControl_CustomUnboundColumnData" dxc:ThemeManager.ThemeName="Azure">
<dxg:GridControl.Resources>
<DataTemplate x:Key="{dxgt:RowIndicatorThemeKey ResourceKey=IconPresenterTemplate}">
<StackPanel x:Name="root" Orientation="Horizontal">
<TextBlock Text="{Binding Path=DataContext.RowNumber}" Margin="2"/>
<ContentPresenter x:Name="iconPresenter" Content="{x:Null}"/>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="Focused">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=FocusedIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="Changed">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=ChangedIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="NewItemRow">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=NewItemRowIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="Editing">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=EditingIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="Error">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=ErrorIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="FocusedError">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=FocusedErrorIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IndicatorState}" Value="AutoFilterRow">
<Setter Property="ContentTemplate" Value="{DynamicResource {dxgt:RowIndicatorThemeKey ResourceKey=AutoFilterRowIconTemplate}}" TargetName="iconPresenter"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=(dxe:BaseEdit.HasValidationError)}" Value="True">
<Setter Property="ToolTip" TargetName="root">
<Setter.Value>
<DockPanel>
<dxe:ErrorControl Content="{Binding Path=(dxe:BaseEdit.ValidationError)}"/>
<ContentPresenter VerticalAlignment="Center" Content="{Binding Path=(dxe:BaseEdit.ValidationError).ErrorContent}" />
</DockPanel>
</Setter.Value>
</Setter>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</dxg:GridControl.Resources>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Text"/>
<dxg:GridColumn FieldName="Number"/>
<dxg:GridColumn FieldName="RowNumber" UnboundType="Integer" Visible="False" ShowInColumnChooser="False" AllowColumnFiltering="False"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView IndicatorWidth="30"/>
</dxg:GridControl.View>
</dxg:GridControl>
</Window>