xaml - visibility of 2 buttons with similar style WPF -
I use a custom style WPF button with following style [Objective button is content (a star image) on mouseover Is visible only)
& lt; Style x: key = "seebookmark highbootstyle" target type = "{x: type button}" & gt; & Lt; Style.Resources & gt; & Lt; Storyboard x: key = "mouseover animation" & gt; & Lt; Double animation duration = "0: 0: 1" from "=" 1 "storyboard. Target = "opacity" /> & Lt; / Storyboard & gt; & Lt; Storyboard x: key = "mouseauton animation" & gt; & Lt; Double animation duration = "0: 0: 1" to = "0" storyboard. Target = "opacity" /> & Lt; / Storyboard & gt; & Lt; /Style.Resources> & Lt; Setter Property = "Opacity" value = "1" & gt; & Lt; / Setter & gt; & Lt; Setter property = "margin" value = "0" & gt; & Lt; / Setter & gt; & Lt; Setter Property = "Content" & gt; & Lt; Setter.Value & gt; & Lt; Image source = "picture \ star_inactive.png" margin = "15" /> & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: type button}" & gt; & Lt; Border background = "transparent" & gt; & Lt; ContentPresenter margin = "{TemplateBinding padding}" HorizontalAlignment = "center" content = "{TemplateBinding content}" VerticalAlignment = "center" /> & Lt; / Border & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; Style.Triggers & gt; & Lt; Trigger Property = "Ismouth Over" Value = "True" & gt; & Lt; Setter property = "background" value = "transparent" /> & Lt; Trigger.EnterActions & gt; & Lt; StartStoryboard Storyboard = "{static resource mouseover animation}" /> & Lt; /Trigger.EnterActions> & Lt; Trigger.ExitActions & gt; & Lt; StartStoryboard Storyboard = "{Statatic Resource MouseAut Animation}" /> & Lt; /Trigger.ExitActions> & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; And in the xaml page I used 2 instances of this type of
But only one button is visible when running or is there any such resolution available or not? Or to follow the same style of the second button or do I need to duplicate another styling?
set x: share = "false" for style X: Share : Modifies the WPF Resource Recovery behavior, so that the request for the attribute is requested instead of sharing the same frequency for all requests Make a new example for & lt; Style x: key = "ViewBookmarkRemoveButtonStyle" x: shared = "false" target type = "{x: type button}" & gt; .... & lt; / Style & gt; For X go to: Shared
Another Approach : Adding an Image to Presenting Content. Content & lt; ControlTemplate TargetType = "{x: type button}" & gt; & Lt; Border background = "transparent" & gt; & Lt; ContentPresenter Margin = "{TemplateBinding Padding}" Horizontal Alignment = "Center" Vertical Element = "Center" & gt; & Lt; ContentPresenter.Content & gt; & Lt; Image source = "login.jpg" margin = "2" /> & Lt; /ContentPresenter.Content> & Lt; / ContentPresenter & gt; & Lt; / Border & gt; & Lt; / ControlTemplate & gt;
Comments
Post a Comment