1

我想在某个事件上更改选项卡的颜色。项目的 ISL 文件包含以下内容:

<styleLibrary>
  <styleSets defaultStyleSet="Default">
    <styleSet name="Default" viewStyle="Standard">
      ...
      <styles>
        ...
        <style role="TabItem">
          <states>
            <state name="Normal">
              <resources>
                <name>Header</name>
              </resources>
            </state>

            <state name="HotTracked">
              <resources>
                <name>HeaderHotTrack</name>
              </resources>
            </state>

            <state name="Active">
              <resources>
                <name>HeaderActive</name>
              </resources>
            </state>
            ...
          </states>
        </style>
      </styles>
    </styleSet>
  <resources>
    ...
    <resource name="Header" backColor="White" foreColor="Black" backColor2="255, 152, 53" backGradientStyle="Vertical" />

    <resource name="HeaderActive" backColor="255, 237,175" foreColor="Black" backColor2="255, 127, 0" backGradientStyle="Vertical" />

    <resource name="HeaderHotTrack" backColor="25, 237, 175" foreColor="White" backColor2="255,127, 0" backGradientStyle="Vertical" />

    <resource name="HeaderHasUpdates" backColor="Green" foreColor="Black" backColor2="White" backGradientStyle="Vertical" />
    ...
  </resources>
</styleLibrary>

当程序开始时,它会加载:

Infragistics.Win.AppStyling.StyleManager.Load()

选择选项卡时,选项卡将着色为名为“HeaderActive”的资源。在某个触发器上,我希望它切换到名为“HeaderHasUpdates”的资源。我目前没有工作的是这个(mdiTab 是 Infragistics.Win.UltraWinTabbedMdi.MdiTab):

mdiTab.Settings.TabAppearance.StyleResourceName = "HeaderHasUpdates"

如果我删除除“HeaderHasUpdates”之外的所有资源,前景色确实会发生变化,这让我认为还有另一个地方正在设置颜色,而在那个地方,前景色没有被设置。我只是不熟悉颜色样式的优先级。

那么我能做些什么来改变风格呢?

-- 编辑 2012 年 4 月 17 日 --

作为记录,在 <styleSet> 和 <styles> 之上添加的修复:

<componentStyles>
  <componentStyle name="UltraTabbedMdiManager" resolutionOrder="ControlThenApplication">
    <properties>
      <property> name="ViewStyle" colorCategory="{Default}">Office2003</property>
    </properties>
  </componentStyle>
</componentStyles>

以防万一您不想使用 AppStylist

4

1 回答 1

1

从来没有这样做过,所以这需要测试,但是我认为你可以尝试在你的 ISL 文件中定义两个 StyleSet。(样式资源管理器-> 添加)

In the first you set your default style, in the second you define only the Style for the TabHeader. When you need the different style, just set the StyleSetName to the second StyleSet available in your ISL file. Don't know if some kind of refresh will be needed.

Also if you want to override the settings from appstylist with appearances defined at design time, you would need to check the ResolutionOrder in AppStylist Go to "Component Role Settings->Infragistics Components->UltraTabControl->ResolutionOrder" The ResolutionOrder is, by default, set to ApplicationThenControl which means that the AppStyling property values take precedence over any control settings for the corresponding appearance properties. In your case, you should change that to ControlThenApplication so the properties set on the control will take precedence.

于 2012-04-16T19:49:28.123 回答