wpf - ControlTemplate with changes for every class -
I have the following ControlTemplate that is the same for all my custom controls.
& amp; the lift; ControlTemplate x: key = "PssFunctionControlBaseHorizontal" TargetType = "Local: PssFunctionControlBase" & gt; & Lt; Grid & gt; & Lt; Threshold Threshold = "1" & gt; & Lt; Content Control X: Name = "Inner Content" Template = "{Static Resources Inner Contentbase Horizontal}" /> & Lt; / Border & gt; & Lt; Control x: name = "PART_ResizeDecorator" visibility = "short" template = "{static resource resize deccurratematet}" /> & Lt; / Grid & gt; & Lt; ControlTemplate.Triggers & gt; & Lt; Data Trigger Value = "True" Binding = "{Binding Editing Moded, Relative Soros = {ResolveSource Search Engineer, Instant Type = {x: Type Local: PssViewLayoutControl}}}" & gt; & Lt; Setter target name = "PART_ResizeDecorator" property = "visibility" value = "visible" /> & Lt; / DataTrigger & gt; & Lt; /ControlTemplate.Triggers> & Lt; / ControlTemplate & gt; Then I use it in a style:
& lt; Style x: key = "BaseStyle" TargetType = "{X: type local: PssFunctionControlBase}" & gt; & Lt; Setter Property = "Template" value = "{Static Resources PssFunctionControlBaseHorizontal}" /> & Lt; / Style & gt; But I want to change that contentcontroll "InnerContent" to replace your template with every category.
Example
& lt; Style TargetType = "{x: type local: PssFunctionControlSlider}" based on = "{static resource basestile}" & gt; Line & Lt; / Style & gt; How can I get it?
Type a different property type DataTemplate and bind that InnerContent < / Code> for Public DataTemplate InnerContentTemplate {{returning (DataTemplate) getValue (InnerContentTemplateProperty) } Set {Set Value (Inner ContentMippleProperty, Value); }} // Using a dependency property as a backing store for InnerContentTemplate enables this animation, style, banding, etc. ... public static Readonly DependencyProperty InnerContentTemplateProperty = DependencyProperty.Register ("InnerContentTemplate", typeof (DataTemplate), typeof (PssFunctionControlSlider), new UIPropertyMetadata (zero)); Your base template ...
This template was templated in & Lt; / Border & gt; & Lt; Control x: name = "PART_ResizeDecorator" visibility = "short" template = "{static resource resize deccurratematet}" /> & Lt; / Grid & gt; & Lt; ControlTemplate.Triggers & gt; & Lt; DataTrigger value = "true" binding = "{EditModeEnabled binding, RelativeSource = {RelativeSource FindAncestor, AncestorType = {x: type local: PssViewLayoutControl}}}" & gt; & Lt; Setter target name = "PART_ResizeDecorator" property = "visibility" value = "visible" /> & Lt; / DataTrigger & gt; & Lt; /ControlTemplate.Triggers>
Set Incentant template to your derived styles ... style target type = "{X: Type Local: PssFunctionControlSlider}" based on = "{static resource base}" & gt; & Lt; Setter Property = "Incoreontentplet" value = "Your Template" /> & Lt; / Style & gt;
Comments
Post a Comment