Hi, so I want to be able to have interchangeable themes within my application and I thought of two ways I could do this:
Xaml Files
By this the user would be able to select an XAML file containing the brushes for the controls I want to style, so like this:
Are there any disadvantages to letting users doing this, such as them being able to add XAML on themselves like:Code:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <!-- Normal --> <LinearGradientBrush x:Key="NormalBackground" StartPoint="0,0" EndPoint="0,1"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="#f1f5f6" Offset="0.0"/> <GradientStop Color="#c9d7da" Offset="1.0"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> <SolidColorBrush x:Key="NormalBorder" Color="#1785f8" /> <SolidColorBrush x:Key="Foreground" Color="#637275" /> <Thickness x:Key="NormalThickness" Left="3" Top="3" Right="3" Bottom="3" /> </ResourceDictionary>
Which would be a problem because I only intend certain parts of the application to be skinable, the XAML file would contain the brushes and then I would do the styling.Code:<Style x:Key="LeftScrollViewer" TargetType="{x:Type ScrollViewer}"> <!-- Rest of stuff here -->
or
XML Files
So this was I was thinking that, like XAML files the users would be able to select one that would contain the theme data:
Obviously this way isn't as flexible as merging XAML files, although it would stop users adding their own XAML to the application to edit stuff I don't want to be edited.Code:<?xml version="1.0" encoding="UTF-8"?> <Theme> <Normal Border="#1785f8" Thickness="0" Opacity="0.7" Foreground="#637275" Start="#f1f5f6" End="#c9d7da" /> </Theme>
Any help on what way is better is appreciated, thankyou.




Reply With Quote