开发者

Override ControlTemplate - not Style

I'm overriding the Content of a Button. My problem is that the default Style of the button gets overridden when I do this. How can I keep the old style (the old style defines mouseover, mouseout effects and the like)?

This is my code:

 <Fluent:DropDownButton SizeDefinition="Small">                                                              
     <Fluent:DropDownButton.Template>    
         <ControlTemplate>                                                                          
             <StackPanel>
                 <Label Co开发者_Python百科ntent="A" FontFamily="Times New Roman" FontSize="11"/>
                 <Polygon Points="0,0 0,15 15,15 15,0"
                          Stroke="{Binding Fill}" 
                          StrokeThickness="5">                                               
                 </Polygon>
             </StackPanel>
         </ControlTemplate>
     </Fluent:DropDownButton.Template>
     <ColorSelectorModule:ColorGallery/>
 </Fluent:DropDownButton>

P.S.: I know this is a question for a specific Library Control. However, I didn't get any response on the project's forum.

To further explain the attributes of the Fluent:DropDownButton: The Content of the Button (the code inbetween the Fluent:DropDownButton-Tags) doesn't determine what's in the button, but what is displayed in the DropDownMenu of the button. This is why I have to modify the content of the button itself (the area where you click to activate the DrowDownMenu).

What I'm trying to code here is a FontColor-Button, with a behaviour similar to a Word-FontColor-Button, where you see the current color in a bar inside the button.


For anyone who's interested, here's a link to my solution on the Fluent's project page: http://fluent.codeplex.com/Thread/View.aspx?ThreadId=221817


You are changing just the template, the template defines the behavior you are talking about not the style, there is no template inheritance so you have to manually copy all the behavior from the old template

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜