开发者

Can I have two different Styles in a CustomControl

开发者 https://www.devze.com 2022-12-29 17:38 出处:网络
Can we have two different styles in generic.xaml setter template Property Something like: <Setter Property=\"Template\">

Can we have two different styles in generic.xaml setter template Property

Something like:

<Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:customLocalFolderButton">
                  **<----Style 1---->**
                  </ControlTemplate TargetType="local:customLocalFolderButton">
       开发者_C百科          </Setter.Value>

              <Setter.Value>
                <ControlTemplate TargetType="local:customLocalFolderButton">
                  **<----Style 2---->**
                  </ControlTemplate TargetType="local:customLocalFolderButton">
                 </Setter.Value>
</Setter>

Now I want to load the styles , as per the requirement. The 1st Style Can have a Red Folder and the Second Style Can have Blue Folder .

The user can choose any of the theme and the choosen style(Either RedFolder or Blue) should be applied in the customControl it self.

Thanks, Subhen


No, you cannot have two implicit default styles. This would need to be done through static resources instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消