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
340
How to assign DataRecordPresenterStyle using Binding and styleConverter
posted

Hello,

I am looking to achieve something like this

<igDP:XamDataGrid.FieldLayoutSettings>

 

 

 

 

 

 

<igDP:FieldLayoutSettings DataRecordPresenterStyle="{Binding Path=Record, Converter={StaticResource rowStyleConverter}}" />

 

 

 

 

</igDP:XamDataGrid.FieldLayoutSettings>

 

 

basically, for each row we have our setting to display like BG/FG colors, Font style etc. so instead of writing three/four converters which get applied for one row I was thinking if we could achieve something like above where we assign styles based on data in the row.

Please help.

It seems to compile and everything, it just doesn't the break point in the converter.

public object Convert(object value, Type targetType,object parameter, CultureInfo culture)
{

 

 

 

if (value == null)
  
return Binding.DoNothing;

 

 

 

TransactionViewModel model = value as TransactionViewModel;

 

 

 

if (model==null)return Binding.DoNothing;

 

 

 

Style style = new Style();

style.Setters.Add(

 

new Setter(DataRecordCellArea.BackgroundProperty, Brushes

.Red ));

 

 

 

return style;

 

 

 }