WPF Style Inheritance -


I have this XAML if I delete the stackpanel. The Resource Sections I receive those styles which were defined at the application level. If I leave it, then I just get a new style.

How do I mix it in both local and global styles?

  & lt; Window x: class = "main window" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" Title = "main window" height = "350" width = "525" & gt; & Lt; DockPanel & gt; & Lt; Stackpaneel dockpanel.doc = "top" orientation = "horizontal" & gt; & Lt; StackPanel.Resources & gt; & Lt; Style TargetType = "TextBlock" & gt; & Lt; Setter property = "margin" value = "4" /> & Lt; / Style & gt; & Lt; Style TargetType = "Button" & gt; & Lt; Setter property = "margin" value = "4" /> & Lt; / Style & gt; & Lt; /StackPanel.Resources> & Lt; Border padding = "5" borderbrush = "blue" borderline = "4" & gt; & Lt; StackPanel & gt; & Lt; TextBlock & gt; Application & lt; / TextBlock & gt; & Lt; Button & gt; Open issue & lt; / Button & gt; & Lt; Button & gt; Services & lt; / Button & gt; & Lt; / StackPanel & gt; & Lt; / Border & gt; & Lt; / StackPanel & gt; & Lt; StackPanel & gt; & Lt; / StackPanel & gt; & Lt; / DockPanel & gt; & Lt; / Window & gt;  

If it helps, then I define global styles in this way.

  & lt; Application x: class = "application" xmlns = "http: //schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" Startup Yuri = "Main Wandow. XML" & gt; & Lt; Application.Resources & gt; & Lt; Resource source source = "shineblue xml" /> & Lt; /Application.Resources> & Lt; / Application & gt;  

  to combine application level + local resources  

Local Resource Definition

  style target type = "text block" based on = "{StaticResource StyleA}" & gt; & Lt; Setter property = "margin" value = "4" /> & Lt; / Style & gt;  

This will give you style of app level and locally


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -