Hello,
I am looking to achieve something like this
<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;
}
Hello Stefan,
Thanks for your solution it works. I am now able to set BG/Fg for the rows.But for some reason it just gives me an error when I try to set the Font Style. I will send the exact exception tomorrow if I can't figure out myself.
Also, there is one more thing, How can I create columns of the data grid from codebehind or may by by some binding. When I create columns using following code grid just appears without any columns.
I am not sure what I am doing wrong in this case.
ThanksVish
var
fld = new FieldLayout();fld.IsDefault = true;
foreach(GridColumn column in Columns){ fld.Fields.Add(new Field (column.ColumnName,column.HeaderName)); }grdDataGrid.FieldLayouts.Add(fld);
Hello Vish,
When you have time please look at it and let me know if you need further clarifications on this matter.
Looking forward for your reply.
Once again I didn't recieve the notification email for your earlier email. I will look at the solution and will come back to you.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
I created a sample project for you using the XamDataGrid’s DataRecordAreaStyleSelector Property and I assign two different Styles for it depending on one of the Record’s Cell’s Value, but you can add more criteria if you want in the SelectStyle method of the DRPStyleSelector class where the item value is DataRecord. Please let me know if this is what you are trying to achieve opt I have misunderstood you in some way.