Hello,
we have columns or individual cell that have been set to use a dropdown list like this (column case):
column.EditorComponent = null; column.Style = ColumnStyle.DropDownList; column.ButtonDisplayStyle = ButtonDisplayStyle.OnCellActivate; column.ValueList = GetOrCreateValueList(layout, key); // some method to build a value list
In case we run in a Chinese UI culture we want to set a dedicated font. To achieve this we set a couple of appearance overrides in a handler of the InitializeLayout event:
eventArgs.Layout.Override.CellAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.ActiveRowAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.EditCellAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.SelectedRowAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.RowAppearance.FontData.Name = "Microsoft Yahei";
eventArgs.Layout.Override.ActiveRowCellAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.FixedCellAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.FixedRowAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.FixedRowCellAppearance.FontData.Name = "Microsoft Yahei"; eventArgs.Layout.Override.ReadOnlyCellAppearance.FontData.Name = "Microsoft Yahei";
Now the problem: the cells/columns that have the dropdown list style set use the wrong font in the following cases:
- when the row is not selected
- in the drop down list
Do you have a suggestion how I can make sure that the font is properly I set in the two cases?
I tried to get a reference to the EditorWithCombo instance after setting the column.Style property but I don't know how to set the font family there and if that would help to solve the issues anyway.
Thanks and best regards
Uwe
Thank you for contacting Infragistics Support.
You are on the right way. In order to set the font of the dropdown list you need to set the Appearance property of your ValueList. Please not it is a good practice to reuse Appearance object. You may find more information about this topic by following the next link http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=WinGrid_Memory_Usage.html
Please find attached a sample solution implementing this approach and let me know if this is what you are looking for or if I am missing something.
Hello Milko,
thanks for the fast response. Your sample looks as expected (I set the text and font as required in my application and it renders as expected). However, integrating this into the "real" application didn't resolve the issue. There seems to be "something else" that overrides the appearance I have set on the ValueList (when I use HawkEye to retrieve the properties of the ActiveCell I can see that the Appearance of the ValueListResolved property has the correct font set - nevertheless it is not used for rendering).
Is there anything specific I could look out for, i.e. what could override the font property that I have set on a ValueList explicitly as you proposed?