CustomControl Styling Question
-
I created this dummy control to ask the question... It's a TextBox with 2 buttons. If I wanted to give this control in an assembly to another developer, how would they modify the style to fit their needs? You can see I have named my brushes with some care, but what about changing triggers or maybe animations and other things? If this is all inside an assembly, how does the developer know how the style works what the style does? Generica.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyControl"><SolidColorBrush x:Key="Button.Normal.Foreground" Color="SteelBlue"/> <SolidColorBrush x:Key="Button.Normal.Background" Color="BlanchedAlmond"/> <SolidColorBrush x:Key="Button.Normal.Border" Color="DarkGray"/> <SolidColorBrush x:Key="Button.Hover.Background" Color="Orange"/> <SolidColorBrush x:Key="Button.Hover.Border" Color="#FF3C7FB1"/> <SolidColorBrush x:Key="Button.Pressed.Foreground" Color="Salmon"/> <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FF737B7F"/> <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/> <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="DarkGray"/> <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/> <SolidColorBrush x:Key="TextBlock.Normal.Foreground" Color="SteelBlue"/> <SolidColorBrush x:Key="TextBlock.Normal.Background" Color="BlanchedAlmond"/> <SolidColorBrush x:Key="TextBlock.Normal.Border" Color="DarkGray"/> <SolidColorBrush x:Key="TextBlock.Hover.Background" Color="#FFBEE6FD"/> <SolidColorBrush x:Key="TextBlock.Hover.Foreground" Color="Blue"/> <SolidColorBrush x:Key="TextBlock.Hover.Border" Color="#FF3C7FB1"/> <SolidColorBrush x:Key="TextBlock.Pressed.Foreground" Color="Blue"/> <SolidColorBrush x:Key="TextBlock.Pressed.Background" Color="#FF737B7F"/> <SolidColorBrush x:Key="TextBlock.Pressed.Border" Color="#FF2C628B"/> <SolidColorBrush x:Key="TextBlock.Disabled.Foreground" Color="DarkGray"/> <SolidColorBrush x:Key="TextBlock.Disabled.Background" Color="#FFF4F4F4"/> <SolidColorBrush x:Key="TextBox.Normal.Foreground" Color="SteelBlue"/> <SolidColorBrush x:Key="TextBox.Normal.Background" Color="Wh
-
I created this dummy control to ask the question... It's a TextBox with 2 buttons. If I wanted to give this control in an assembly to another developer, how would they modify the style to fit their needs? You can see I have named my brushes with some care, but what about changing triggers or maybe animations and other things? If this is all inside an assembly, how does the developer know how the style works what the style does? Generica.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyControl"><SolidColorBrush x:Key="Button.Normal.Foreground" Color="SteelBlue"/> <SolidColorBrush x:Key="Button.Normal.Background" Color="BlanchedAlmond"/> <SolidColorBrush x:Key="Button.Normal.Border" Color="DarkGray"/> <SolidColorBrush x:Key="Button.Hover.Background" Color="Orange"/> <SolidColorBrush x:Key="Button.Hover.Border" Color="#FF3C7FB1"/> <SolidColorBrush x:Key="Button.Pressed.Foreground" Color="Salmon"/> <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FF737B7F"/> <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/> <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="DarkGray"/> <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/> <SolidColorBrush x:Key="TextBlock.Normal.Foreground" Color="SteelBlue"/> <SolidColorBrush x:Key="TextBlock.Normal.Background" Color="BlanchedAlmond"/> <SolidColorBrush x:Key="TextBlock.Normal.Border" Color="DarkGray"/> <SolidColorBrush x:Key="TextBlock.Hover.Background" Color="#FFBEE6FD"/> <SolidColorBrush x:Key="TextBlock.Hover.Foreground" Color="Blue"/> <SolidColorBrush x:Key="TextBlock.Hover.Border" Color="#FF3C7FB1"/> <SolidColorBrush x:Key="TextBlock.Pressed.Foreground" Color="Blue"/> <SolidColorBrush x:Key="TextBlock.Pressed.Background" Color="#FF737B7F"/> <SolidColorBrush x:Key="TextBlock.Pressed.Border" Color="#FF2C628B"/> <SolidColorBrush x:Key="TextBlock.Disabled.Foreground" Color="DarkGray"/> <SolidColorBrush x:Key="TextBlock.Disabled.Background" Color="#FFF4F4F4"/> <SolidColorBrush x:Key="TextBox.Normal.Foreground" Color="SteelBlue"/> <SolidColorBrush x:Key="TextBox.Normal.Background" Color="Wh
Well, the easiest way to let people know is if you document the styles just the way you have here. If people want to adjust the triggers and templates, they can see what is affected just by reading the documentation.