Hi,
I use UltraGrid in virtual mode. I wanted to disable hottrack feature on cells, so I set CellHottrackInvalidationStyle to CellHottrackInvalidationStyle.Never.
_grid.DisplayLayout.CellHottrackInvalidationStyle = CellHottrackInvalidationStyle.Never;
Everything worked as I expected.
However, when I loaded an isl file (Office2010Black.isl or Office2010Silver.isl) by using StyleManager.Load, hottracking was unexpectedly enabled for ValueList columns. Here is the code I setup a value list to a column:
private void SetDropdownValueList(IFieldInfo fieldInfo, UltraGridColumn column) { var valueList = new BindableValueList { BindingContextControl = GridControl, DataSource = fieldInfo.DropdownValueList.ValueList }; if (!string.IsNullOrEmpty(fieldInfo.DropdownValueList.ValueMember)) valueList.ValueMember = fieldInfo.DropdownValueList.ValueMember; if (!string.IsNullOrEmpty(fieldInfo.DropdownValueList.DisplayMember)) valueList.DisplayMember = fieldInfo.DropdownValueList.DisplayMember; column.ValueList = valueList; column.Style = ColumnStyle.DropDownList; }
Could someone help me to solve this issue please?
Thanks,Shaolin
Hi Ivaylo,
There is another issue after loading a style. The changes to CellAppearance of a ValueList UltraGridColumn column have no effect. Could you please look into this?
Best Regards,Shaolin
Thanks so much for your detailed explanation!
I modified your attached sample:
public Form1() { InitializeComponent(); string path = @"C:\Users\Public\Documents\Infragistics\2016.1\Windows Forms\Samples\Legacy\Data\StyleLibrary\Office2010Black.isl"; Infragistics.Win.AppStyling.StyleManager.Load(path); }
Your sample application did not work as expected after I loaded Office2010Black.isl. Hottracking was always enabled.
Hi Shaolin,
Thank you for posting in our forums!
Reading though your scenario, I would like to divide it into two states. The first is without a style library and the second is after loading a style library.
Without a style library
The UltraGrid has some cell hot track appearance set and you would like to have a toggle button for enabling and disabling the hot tracking on cells. The property CellHottrackInvalidationStyle only prevents the cells from redrawing themselves when it is not necessary, which improves the performance of the UltraGrid and this is its main purpose. However, it would work for your scenario as well (disabling hot tracking on cells) in the most of the cases, but not in all. For example, for value list or Boolean cells it initially will not work. Therefore, the most appropriate and convenient way of disabling hot tracking on any element is resetting it to its default value and assigning back the same appearance object when it is necessary.
Loading a style library
When a style library is loaded it is loaded with higher priority upon the appearance objects and as a result overrides all previously set appearances. Because of that, the previous approach of enabling and disabling the hot track appearance will not work. On the other hand, each style library can have many style sets. Except from styling the whole application, this allows you to style individual controls completely different than the general style. For example, you do not want to have hot track appearance in the UltraGrid, and therefore a style set with default hot track appearance is loaded. At a given moment, the hot tracking should be back and as a results a style set with hot track appearance applied is loaded back. At the following forum thread is explained how to switch between different style sets.
For further reference, please see the attached sample application and let me know if you have any additional questions regarding this matter.