xaml - How are you keeping your WPF resources organized on large projects? -


Even the smallest WPF example and prototype I am doing, the app.xaml , starts running fast it keeps all of my windows and user strokes out, but it is hard to organize (Visual Studio "XAM Folding" feature is no help since then you have only one word filled with the word "style ...").

Besides, I am struggling to give my style easy to name-remember and come in a systematic manner. . Best way to me This is very long and descriptive, so I can find things like this: BottomMainLeftScrollViewerStyle, etc. But it has its limitations and soon becomes confusing I decided to use the camel case case for style names so that they can easily find pages and pages of XAM.

What are your policies Wrap to prevent WPF resources from occurring?

& lt; window. Resources & gt; & Lt; Local: CutOffConverter x: key = "life saving" cutoff = "30" /> & Lt; Style TargetType = "Grid" x: Key = "customerGridMainStyle" & gt; & Lt; Setter Property = "Background" & gt; & Lt; Setter.Value & gt; & Lt; LinearGradientBrush StartPoint = "0,0" Endos = ".5, .5" & gt; & Lt; GradientStop Offset = "0.0" Color = "# 888" /> & Lt; GradientStop Offset = "1.0" Color = "#ccc" /> & Lt; / LinearGradientBrush & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt; & Lt; Style TargetType = "StackPanel" x: Key = "mainStackPanelStyle" & gt; & Lt; Setter property = "horizontal alignment" value = "left" /> & Lt; / Style & gt; & Lt; Style TargetType = "ScrollViewer" x: Key = "mainScrollViewerStyle" & gt; & Lt; Setter property = "height" value = "250" /> & Lt; / Style & gt; & Lt; Style TargetType = "ListBox" x: Key = "mainListBoxStyle" & gt; & Lt; Setter Property = "BorderTitches" value = "0" /> & Lt; Setter property = "margin" value = "10" /> & Lt; / Style & gt; & Lt; ObjectDataProvider x: key = "customer" object type = "{x: type local: customer}" methodname = "go control" /> & Lt; DataTemplate DataType = "{x: type local: customer}" & gt; & Lt; Grid X: Name = "Main Grid" style = "{static resource customergrid main style}" & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column width = "100" /> & Lt; Column width = "150" /> & Lt; /Grid.ColumnDefinitions> & Lt; Grid.RowDefinitions & gt; & Lt; RowDefinition / & gt; & Lt; RowDefinition / & gt; & Lt; RowDefinition / & gt; & Lt; /Grid.RowDefinitions> & Lt; Text block grid Column = "0" grid. Line = "0" text = "first name" margin = "5" /> & Lt; TextBlock Grid.Column = "1" grid. Line = "0" text = "{binding firstname}" margin = "5" /> & Lt; Text block grid Column = "0" grid. Line = "1" text = "last name" margin = "5" /> & Lt; Text block grid Column = "1" grid. Line = "1" text = "{binding last name}" margin = "5" /> & Lt; Text block grid Column = "0" grid. Line = "2" text = "age" margin = "5" /> & Lt; TextBlock x: name = "age" grid. Column = "1" grid. Line = "2" text = "{binding age}" margin = "5" /> & Lt; / Grid & gt; & Lt; DataTemplate.Triggers & gt; & Lt; Data Trigger Binding = "{Binding Path = Age, Converter = {Static Resources Edge Concentrator}}" & gt; & Lt; DataTrigger.Value & gt; True & lt; /DataTrigger.Value> & Lt; Setter target name = "age" property = "foreground" value = "red" /> & Lt; / DataTrigger & gt; & Lt; /DataTemplate.Triggers> & Lt; / DataTemplate & gt; & Lt; /Window.Resources>

Use different ResourceDictionary s and approve them Mix in the level in your visual tree as needed.

  & lt; AP ... & gt; & Lt; App.Resources & gt; & Lt; ResourceDictionary & gt; & Lt; ResourceDictionary.MergedDictionaries & gt; & Lt; Source source = "ListBoxResources.xaml" /> & Lt; Source Source = "ComboBox Resources. XML" /> & Lt; Source source = "LabelResources.xaml" /> & Lt; Source source = "TextBoxResources.xaml" /> & Lt; /ResourceDictionary.MergedDocs> & Lt ;! - If you have local resources, give them a place here (as written by Marc Sinoceae in the comment) - & gt; & Lt; / ResourceDictionary & gt; & Lt; /App.Resources> & Lt; / Application & gt;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -