Hi,
I have a grid where some of the numeric columns have set LabelTextAlignment="Right" to right justify the header text.
However in the field chooser dialog the fields are also displayed right justified in the list which looks rather ridiculous. Is there a way to prevent this 'feature'?
Hello marjones,
Thank you for your post. I have been looking through it and I reproduce your behavior. To prevent this feature, I suggest you add the following code in the FieldChooserOpening Event of your xamDataGrid:
e.FieldChooser.CurrentFields[num].Field.Settings.LabelTextAlignment = TextAlignment.Left;
where "num" is the index of the Field, which is zero based. By doing this you will set the TextAlignment Property of a specific field so that all the headers could look the same in the FieldChooser.
If you have any further questions on this matter do not hesitate to ask.
Thanks for that information.
for anyone else with the same problem heres some complete code for a utility class to do it.
static class XamDataGridUtils { public static void LeftJustifyFieldChooserLabels(XamDataGrid grid) { grid.FieldChooserOpening += grid_FieldChooserOpening; } static void grid_FieldChooserOpening(object sender, FieldChooserOpeningEventArgs e) { foreach(var field in e.FieldChooser.CurrentFields) { field.Field.Settings.LabelTextAlignment = TextAlignment.Left; } } }