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
3166
CellValuePresenterStyle StrikeThrough
posted

I tried to used the style as mentioned in this post http://ko.infragistics.com/community/forums/p/51185/268258.aspx

However instead of using the EditorStyle (Editor) I defined the CellValuePresenterStyle. The reason for this was I already have CellValuePresenterStyle for Border related properties. Do I need to define both the EditorStyle and CellValuePresenterStyle.

In the following example 'name' is using EditorStyle and works. While 'department' is using CellValuePresenterStyle' and does NOT work.

<igDP:XamDataGrid BindToSampleData="True">
<igDP:XamDataGrid.Resources>
<Style x:Key="StrikeThroughEditor"
TargetType="{x:Type editors:XamTextEditor}"
BasedOn="{StaticResource {x:Type editors:XamTextEditor}}">
<Style.Resources>
<Style TargetType="{x:Type controls:SimpleTextBlock}">
<Setter Property="TextDecorations" Value="Strikethrough" />
</Style>
</Style.Resources>
</Style>

<Style x:Key="StrikeThroughCellValuePresenter"
TargetType="{x:Type igDP:CellValuePresenter}"
BasedOn="{StaticResource {x:Type igDP:CellValuePresenter}}">
<Style.Resources>
<Style TargetType="{x:Type controls:SimpleTextBlock}">
<Setter Property="TextDecorations" Value="Strikethrough"/>
</Style>
</Style.Resources>
</Style>
</igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:Field Name="name">
<igDP:Field.Settings>
<igDP:FieldSettings EditorStyle="{StaticResource StrikeThroughEditor}" />
</igDP:Field.Settings>
</igDP:Field>

<igDP:Field Name="department">
<igDP:Field.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource StrikeThroughCellValuePresenter}" />
</igDP:Field.Settings>
</igDP:Field>

</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>

Parents
  • 34510
    Verified Answer
    Offline posted

    Hi Bhavesh,

    The only thing I can think of is that the style located in the CellValuePresenter's Style.Resources for the SimpleTextBlock can't cross the ContentPresenter barrier.  The CellValuePresenter template has a ContentPresenter called PART_EditorSite.  Depending on the data type of the column the content placed in the ContentPresenter will differ.  This is acting like a barrier and content inside the presenter doesn't know anything about the CellValuePresenter which means it ignores the style for SimpleTextBlock.

    This explains why it doesn't work when using the CellValuePresenter.  You need to use the EditorStyle property in order to apply the Strikethrough to the text as this style is directly applied to the ValueEditor located in the CellValuePresenter's PART_EditorSite.

Reply Children