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
896
Programmatically applying style to the CellValuePresenter
posted

Hi

I have this Style


<Style x:Key="HighlightCells" TargetType="{x:Type igDP:CellValuePresenter}">

 


<Setter Property="Background" Value="Red" /></Style>


I am applying it like this

e.Cell.Field.Settings.CellValuePresenterStyle = TryCast(FindResource("HighlightCells"), Style)

in


EditModeEnded event handler

But the style is not getting applied, this is not the case if i apply the same style as a static resource

 

 

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello,

    This is because the CellValuePresenter has to be reinitialized before the style can be applied. For example, if you group and ungroup the style would apply or the cell is scrolled out of view and then back into view.

    You should set the CellValuePresenter's properties directly  or reinitialize the XamDataGrid.

Children
No Data