Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1700
[Style] How to stop selection at fields with FixedToNearEdge
posted

Hello,

I have a xamDataGrid like this : 

<UserControl.Resources>
<values1:SphericalValuesDesignViewModel x:Key="SphericalValuesDesignViewModel" />
<Style x:Key="ForegroundSelectedStyle" TargetType="{x:Type dataPresenter:CellValuePresenter}">
<Setter Property="Background" Value="{StaticResource MediumGrayBrush}" />
<Setter Property="Foreground" Value="{StaticResource WhiteBrush}" />
</Style>
</UserControl.Resources>

<Grid>
<dataPresenter:XamDataGrid x:Name="Values"
Margin="0,10,0,0"
DataContextChanged="OnDataContextChanged"
DataSource="{Binding Path=Lines}"
FieldLayoutInitialized="FieldLayoutInitialized"
GroupByAreaLocation="None"
SelectedDataItemsScope="RecordsOnly">
<dataPresenter:XamDataGrid.FieldLayoutSettings>
<dataPresenter:FieldLayoutSettings AllowClipboardOperations="Copy"
AllowDelete="False"
AllowFieldMoving="No"
AutoArrangeCells="Never"
AutoGenerateFields="False"
CopyFieldLabelsToClipboard="True"
FilterUIType="LabelIcons"
RecordSelectorLocation="None" />
</dataPresenter:XamDataGrid.FieldLayoutSettings>

<dataPresenter:XamDataGrid.FieldLayouts>
<dataPresenter:FieldLayout>
<dataPresenter:Field x:Name="Header"
Column="2"
Label="Azimuth"
Row="0" BindingType="Unbound">
<dataPresenter:Field.Settings>
<dataPresenter:FieldSettings CellContentAlignment="LabelOnly" LabelTextAlignment="Center" />
</dataPresenter:Field.Settings>
</dataPresenter:Field>

<dataPresenter:Field Name="Azimuth"
Width="100"
Column="0"
FixedLocation="FixedToNearEdge"
Row="0"
RowSpan="3">
<dataPresenter:Field.Settings>
<dataPresenter:FieldSettings>
<dataPresenter:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type dataPresenter:CellValuePresenter}">
<Setter Property="Background" Value="{StaticResource MediumGrayBrush}" />
<Setter Property="Foreground" Value="{StaticResource WhiteBrush}" />
<Setter Property="ForegroundSelectedStyle" Value="{StaticResource ForegroundSelectedStyle}"/>
</Style>
</dataPresenter:FieldSettings.CellValuePresenterStyle>
</dataPresenter:FieldSettings>
</dataPresenter:Field.Settings>
</dataPresenter:Field>
<dataPresenter:Field Name="Elevation"
Width="100"
Column="1"
FixedLocation="FixedToNearEdge"
Row="0"
RowSpan="3">
<dataPresenter:Field.Settings>
<dataPresenter:FieldSettings>
<dataPresenter:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type dataPresenter:CellValuePresenter}">
<Setter Property="Background" Value="{StaticResource MediumGrayBrush}" />
<Setter Property="Foreground" Value="{StaticResource WhiteBrush}" />
</Style>
</dataPresenter:FieldSettings.CellValuePresenterStyle>
</dataPresenter:FieldSettings>
</dataPresenter:Field.Settings>
</dataPresenter:Field>
</dataPresenter:FieldLayout>
</dataPresenter:XamDataGrid.FieldLayouts>

<dataPresenter:XamDataGrid.FieldSettings>
<dataPresenter:FieldSettings AllowEdit="False"
AllowGroupBy="False"
AllowRecordFiltering="False"
AllowResize="False"
AllowSummaries="False"
CellClickAction="SelectRecord"
LabelClickAction="Nothing" />
</dataPresenter:XamDataGrid.FieldSettings>
</dataPresenter:XamDataGrid>
</Grid>

If a line is selected, the foreground and background of the line will appear in the first column.

Like this : http://i.imgur.com/KELedc7.png

I want to cut the disgn and let the first column to be with white foreground and grey background.

Do you have some ideas to achieve this ?

Thanks for your help