wpf - Base a ControlTemplate on another ControlTemplate -
I know that there should be an easy answer for this, but I can not find it.
I got a button style named ' Then I want to create another 'derivative' style based on This does not work - "The specified element is already a logical child of another element. Disconnect it first." It seems that I need to redefine the derivative Any thoughts? You can not form the basis of templates on each other, but this error can be easily solved . Instead of setting the hoverbutton .
& lt; Style x: key = "hover button" target type = "button" & gt; & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "Button" & gt; & Lt; Border & gt; & Lt; ContentPresenter / & gt; & Lt; / Border & gt; & Lt; ControlTemplate.Triggers & gt; & Lt; Trigger Property = "Ismouth Over" Value = "True" & gt; & Lt; Setter Property = "Borderbrush" Value = "Black" /> & Lt; Setter Property = "Background" Value = "WhiteSmoke" /> & Lt; Setter Property = "Foreground" Value = "Darkard" /> & Lt; / Catalyst & gt; & Lt; /ControlTemplate.Triggers> & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; Setter Property = "Borderbrush" Value = "Transparent" /> & Lt; Setter property = "background" value = "transparent" /> & Lt; / Style & gt;
hoverbutton with specific content. I have reduced the complexity of the style above, but it is very complex that I do not want to copy and paste it.
style x: key = "CloseButton" basedOn = "{StaticResource HoverButton}" TargetType = "{x: type button}" & gt; & Lt; Setter Property = "Content" & gt; & Lt; Setter.Value & gt; & Lt; Path width = "8" height = "8" stroke = "{Binding foreground, relative Soros = {relative-type search engineer, ancestor type = button}}" data = "M 0,0 L8,8 M8,0 L 0 , 8 "strokectitches =" 2 "/> & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt;
template property, but in some way the reference to a base-style template.
content , create a similar
ContentTemplate , this way a
path is created for each button, and for all the buttons No (which is not allowed)
Comments
Post a Comment