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
1105
Selected row style with conditional formating
posted

Hi,

I've presenting a very large data-set within a XamGrid, each line has different display style and I'm using conditional formatting to do so.

I'm setting all conditional formatting via code after some long loading process.

My problem is that once user selects a row, the style of the row becomes the default style of a selected-row, where the conditional formatting is lost.

I would like the conditional formatting to stay, even when user selects row, and just show a border around the row, make the font bold or any other small appearance change that will let the user know row is selected while keeping the conditional formatting as is?

this is the relevant part of conditional formatting - using a dictionary to create all types of styles


/// <summary>
///
/// </summary>
/// <param name="sourceDataObject"></param>
/// <param name="sourceDataValue"></param>
/// <returns></returns>
protected override Style EvaluateCondition(object sourceDataObject, object sourceDataValue)
{
LogViewerLineInfo lvli = sourceDataObject as LogViewerLineInfo;

  

if (!_styles.ContainsKey(lvli.DisplayAttributes))
_styles.Add(lvli.DisplayAttributes, CreateStyleFromDisplayAttributes(lvli.DisplayAttributes));

return _styles[lvli.DisplayAttributes];
}

private Style CreateStyleFromDisplayAttributes(EOILogViewerDisplayAttributes eOILogViewerDisplayAttributes)
{
Style style = new Style(typeof(ConditionalFormattingCellControl));
style.Setters.Add(new Setter() { Property = ConditionalFormattingCellControl.ForegroundProperty, Value = new SolidColorBrush((Color)ColorConverter.ConvertFromString(eOILogViewerDisplayAttributes.ForegroundColor)) });
style.Setters.Add(new Setter() { Property = ConditionalFormattingCellControl.BackgroundProperty, Value = new SolidColorBrush((Color)ColorConverter.ConvertFromString(eOILogViewerDisplayAttributes.BackgroundColor)) });
style.Setters.Add(new Setter() { Property = ConditionalFormattingCellControl.VerticalAlignmentProperty, Value = VerticalAlignment.Center });

return style;
}

Parents Reply Children