The reason the line of code you have posted here under #2 does not work is because the isl file overrides any settings in the grid by default. It has to. Otherwise, the isl would not be very useful for making all applications look the same.
If you want the application settings to override those in the isl, you would have to modify the isl. You would go to the grid's component role and set the ResolutionOrder property. This would allow the control settings to override the isl settings. But it's all or nothing.
Another option would be to modify the isl so that it does not apply an appearance to the grid's Active row. This would affect all grid's, however.
Yet another option would be to use a StyleSet. An isl can contain multiple StyleSets and you can set the StyleSetName property on any Infragistics control to tell it to use a specific StyleSet. So what you could do is have 2 StyleSets in your isl: one with an active row appearance and one without. Then you could use one StyleSet for the "main" grid and a different one for the other grids in the application.
If you cannot modify the isl, then you have two other options. One would be to modify the style library information in memory. This is rather complicated and once again has the disadvantage that you can't affect some controls without affecting others.
The last optoin would be to use a DrawFilter and explicitly modify the colors while the grid is painting. If you want to try this and you are not familiar with DrawFilter, I recommend checking out the Infragistics Knowledge Base. There are lots of articles with sample DrawFilters. Also, get the Infragistics UIElementViewer Utility. It's a huge help with dealing with UIElements.
以上E文链接地址:http://news.infragistics.com/forums/p/11305/42882.aspx#42882
问题描述:在使用UltraGrid中进行开发的时候,遇到一个问题,就是当加载数据到该控件后会默认第一行为actived状态,而在UltraGrid中,当某行的状态是Actived状态时候会自动给该行加上颜色(通常该颜色和某行的状态为selected的颜色是一样的)。到底该怎样除去该默认行的颜色呢?
解决办法:根据上面的E文可以看到如果UltraGrid使用了isf file(样式文件)文件的话,则你在代码里写的控制将会被覆盖掉,最后会按照isf file文件的设置来配置ultragrid等控件的样式,解决办法有好几种,一种就是取消使用isf file文件,取消的办法是,在NetAdvantage的控件的属性中,找到UseAppStyling,然后将其设置为false既可。
第二种是,找到该isf file 然后将
<state name="Active">
<resources>
<name>GridRow_Selected</name>
</resources>
</state>
这段代码取消掉即可。
代码里控制布局在InitializeLayout事件中加上:
//不允许行选择
e.Layout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.None;
// 允许进行排序.
e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle;
浙公网安备 33010602011771号