home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Skins and Design
Button foreground color
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="morpheus_xx" data-source="post: 920256" data-attributes="member: 48495"><p>Let me describe some basic steps here, how to find the information you want. Take this as a small tour into the MP2 xaml files <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p> </p><p>Let's start to investigate the "default" skin. It's defined inside the "SkinBase" plugin.</p><p> </p><p>For buttons we check the folder structure of the "SkinBase" plugin:</p><p> </p><p>[CODE][SkinBase]</p><p> Skin</p><p> default (skin name)</p><p> themes</p><p> default (theme name)</p><p> styles</p><p> Buttons.xaml[/CODE]</p><p> </p><p>So yes, Buttons.xaml we are looking for. So next look into this xaml file:</p><p> </p><p>[CODE]</p><p>....</p><p> <!-- ************************* Control styles for buttons ************************* --></p><p> </p><p> <Style x:Key="ButtonControlStyle" TargetType="{x:Type Control}"></p><p> <Setter Property="Template"></p><p> <Setter.Value></p><p> <ControlTemplate></p><p> <Rectangle x:Name="ButtonControlRectangle" Stroke="{ThemeResource ButtonStrokeColor}"</p><p> RadiusX="{ThemeResource ButtonControlRadiusX}" RadiusY="{ThemeResource ButtonControlRadiusY}"></p><p> <Rectangle.Fill></p><p> <RadialGradientBrush GradientOrigin="0.85,0.82"></p><p> <RadialGradientBrush.RelativeTransform></p><p> <TransformGroup></p><p> <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.335" ScaleY="1.582"/></p><p> <TranslateTransform X="0.027" Y="-0.006"/></p><p> </TransformGroup></p><p> </RadialGradientBrush.RelativeTransform></p><p> <GradientStop Color="{ThemeResource ButtonGradient1Color}" Offset="0"/></p><p> <GradientStop Color="{ThemeResource ButtonGradient2Color}" Offset="1"/></p><p> </RadialGradientBrush></p><p> </Rectangle.Fill></p><p> </Rectangle></p><p> </ControlTemplate></p><p> </Setter.Value></p><p> </Setter></p><p> </Style></p><p>[/CODE]</p><p> </p><p>This is the main definition of the button "background". Here is no content yet...</p><p>Next:</p><p>[CODE]</p><p> <!-- ***************************** Standard buttons ******************************** --></p><p> </p><p> <Style x:Key="DefaultButtonStyle" TargetType="{x:Type Button}"></p><p> <Setter Property="Template"></p><p> <Setter.Value></p><p> <ControlTemplate></p><p> <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="2"></p><p> <Grid.ColumnDefinitions></p><p> <ColumnDefinition Width="*"/></p><p> </Grid.ColumnDefinitions></p><p> <Grid.RowDefinitions></p><p> <RowDefinition Height="*"/></p><p> </Grid.RowDefinitions></p><p> <Grid.RenderTransform></p><p> <TransformGroup></p><p> <ScaleTransform ScaleX="1" ScaleY="1"/></p><p> </TransformGroup></p><p> </Grid.RenderTransform></p><p> <Control Style="{ThemeResource ButtonControlStyle}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/></p><p> <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/></p><p> </Grid></p><p> <ControlTemplate.Triggers></p><p> <Trigger Property="HasFocus" Value="True"></p><p> <Trigger.EnterActions></p><p> <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/></p><p> <SoundPlayerAction Source="button12.wav" DisableOnAudioOutput="True"/></p><p> </Trigger.EnterActions></p><p> <Trigger.ExitActions></p><p> <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/></p><p> </Trigger.ExitActions></p><p> </Trigger></p><p> <Trigger Property="IsPressed" Value="True"></p><p> <Trigger.EnterActions></p><p> <BeginStoryboard x:Name="Pressed_BeginStoryboard" Storyboard="{ThemeResource PressedButtonStoryboard}"</p><p> HandoffBehavior="TemporaryReplace"/></p><p> <SoundPlayerAction Source="button7.wav" DisableOnAudioOutput="True"/></p><p> </Trigger.EnterActions></p><p> <Trigger.ExitActions></p><p> <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/></p><p> </Trigger.ExitActions></p><p> </Trigger></p><p> <Trigger Property="IsEnabled" Value="False"></p><p> <Trigger.EnterActions></p><p> <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/></p><p> </Trigger.EnterActions></p><p> <Trigger.ExitActions></p><p> <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/></p><p> </Trigger.ExitActions></p><p> </Trigger></p><p> </ControlTemplate.Triggers></p><p> </ControlTemplate></p><p> </Setter.Value></p><p> </Setter></p><p> </Style></p><p> </p><p> <!-- Implicit default style for Button controls --></p><p> <Style BasedOn="{ThemeResource DefaultButtonStyle}" TargetType="{x:Type Button}"/></p><p>[/CODE]</p><p>The style for all generic buttons is found! There are more styles (like ButtonWideStyle, which are quite similar).</p><p> </p><p>But still no real button content, that we can change here directly. All content is replaced into this template by</p><p>[CODE]</p><p> <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/></p><p>[/CODE]</p><p> </p><p>Now let's check where this style get's used. Do a "find in project" and search for 'Style="{ThemeResource ButtonWideStyle}"'.</p><p> </p><p>One occurence leads to "othercontrols.xaml":</p><p>[CODE]</p><p> <!-- An item list container represented by a standard "Button", scrolling its "ItemLabel" label when focused --></p><p> <Style x:Key="DefaultMenuItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}"></p><p> <Setter Property="Template"></p><p> <Setter.Value></p><p> <ControlTemplate TargetType="{x:Type ListViewItem}"></p><p> <Button Style="{ThemeResource ButtonWideStyle}"</p><p> Command="{DynamicResource ResourceKey=Menu_Command}"</p><p> IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}"></p><p> <Button.Triggers></p><p> <Trigger Property="HasFocus" Value="True"></p><p> <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/></p><p> <Setter Property="StackPanel.ZIndex" Value="100.0"/></p><p> </Trigger></p><p> </Button.Triggers></p><p> </Button></p><p> </ControlTemplate></p><p> </Setter.Value></p><p> </Setter></p><p> </Style></p><p>[/CODE]</p><p>Yes, there is a button used as a ListViewItem, in general lists (menu, media items), which uses our '<Button Style="{ThemeResource ButtonWideStyle}"...'</p><p> </p><p>There you find a first reference to the label, called '<Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>'. Label contains the text content. Text has a color... So next question, where is this "DefaultMenuItemContainerStyle" used?</p><p> </p><p>[CODE]</p><p> <!-- ListView style to be used for main menu --></p><p> <Style x:Key="MainMenuListViewStyle" BasedOn="{ThemeResource DefaultListViewStyle}"></p><p> <Setter Property="ItemTemplate" Value="{ThemeResource MainMenuItemDataTemplate}"/></p><p> <Setter Property="DataStringProvider" Value="{ThemeResource MainMenuItemDataStringProvider}"/></p><p> <Setter Property="ItemContainerStyle" Value="{ThemeResource DefaultMenuItemContainerStyle}"/></p><p> </Style></p><p>[/CODE]</p><p>Getting better, now let's check the ItemTemplate "MainMenuItemDataTemplate"...</p><p> </p><p>Well, we got it (finally!):</p><p>[CODE]</p><p> <DataTemplate x:Key="MainMenuItemDataTemplate"></p><p> <DockPanel x:Name="ItemControl" LastChildFill="True"></p><p> <Label x:Name="ItemLabel" DockPanel.Dock="Center" Content="{Binding [Name]}" Color="{ThemeResource TextColor}"/></p><p> </DockPanel></p><p> </DataTemplate></p><p>[/CODE]</p><p>There is our label, using the Color "TextColor".</p><p> </p><p>When we now search for the definition of "TextColor" this leads us to the real color, defined inside "colors.xml"</p><p> </p><p>[CODE]</p><p> <!-- White --></p><p> <ResourceWrapper x:Key="TextColor" Resource="White"/></p><p>[/CODE]</p><p> </p><p>This value you can change now to any other color, "Red", "Green", "#FFFFFF" (white), "#A0FFFFFF" (semi transparent white).</p><p> </p><p>As a rule of thumb, look into the .xaml files with suitable names, here "color.xaml" contains all definitions of main colors (or gradients).</p></blockquote><p></p>
[QUOTE="morpheus_xx, post: 920256, member: 48495"] Let me describe some basic steps here, how to find the information you want. Take this as a small tour into the MP2 xaml files :) Let's start to investigate the "default" skin. It's defined inside the "SkinBase" plugin. For buttons we check the folder structure of the "SkinBase" plugin: [CODE][SkinBase] Skin default (skin name) themes default (theme name) styles Buttons.xaml[/CODE] So yes, Buttons.xaml we are looking for. So next look into this xaml file: [CODE] .... <!-- ************************* Control styles for buttons ************************* --> <Style x:Key="ButtonControlStyle" TargetType="{x:Type Control}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Rectangle x:Name="ButtonControlRectangle" Stroke="{ThemeResource ButtonStrokeColor}" RadiusX="{ThemeResource ButtonControlRadiusX}" RadiusY="{ThemeResource ButtonControlRadiusY}"> <Rectangle.Fill> <RadialGradientBrush GradientOrigin="0.85,0.82"> <RadialGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.335" ScaleY="1.582"/> <TranslateTransform X="0.027" Y="-0.006"/> </TransformGroup> </RadialGradientBrush.RelativeTransform> <GradientStop Color="{ThemeResource ButtonGradient1Color}" Offset="0"/> <GradientStop Color="{ThemeResource ButtonGradient2Color}" Offset="1"/> </RadialGradientBrush> </Rectangle.Fill> </Rectangle> </ControlTemplate> </Setter.Value> </Setter> </Style> [/CODE] This is the main definition of the button "background". Here is no content yet... Next: [CODE] <!-- ***************************** Standard buttons ******************************** --> <Style x:Key="DefaultButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="2"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="1" ScaleY="1"/> </TransformGroup> </Grid.RenderTransform> <Control Style="{ThemeResource ButtonControlStyle}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/> <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="HasFocus" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/> <SoundPlayerAction Source="button12.wav" DisableOnAudioOutput="True"/> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/> </Trigger.ExitActions> </Trigger> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="Pressed_BeginStoryboard" Storyboard="{ThemeResource PressedButtonStoryboard}" HandoffBehavior="TemporaryReplace"/> <SoundPlayerAction Source="button7.wav" DisableOnAudioOutput="True"/> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/> </Trigger.ExitActions> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Trigger.EnterActions> <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- Implicit default style for Button controls --> <Style BasedOn="{ThemeResource DefaultButtonStyle}" TargetType="{x:Type Button}"/> [/CODE] The style for all generic buttons is found! There are more styles (like ButtonWideStyle, which are quite similar). But still no real button content, that we can change here directly. All content is replaced into this template by [CODE] <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> [/CODE] Now let's check where this style get's used. Do a "find in project" and search for 'Style="{ThemeResource ButtonWideStyle}"'. One occurence leads to "othercontrols.xaml": [CODE] <!-- An item list container represented by a standard "Button", scrolling its "ItemLabel" label when focused --> <Style x:Key="DefaultMenuItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListViewItem}"> <Button Style="{ThemeResource ButtonWideStyle}" Command="{DynamicResource ResourceKey=Menu_Command}" IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}"> <Button.Triggers> <Trigger Property="HasFocus" Value="True"> <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/> <Setter Property="StackPanel.ZIndex" Value="100.0"/> </Trigger> </Button.Triggers> </Button> </ControlTemplate> </Setter.Value> </Setter> </Style> [/CODE] Yes, there is a button used as a ListViewItem, in general lists (menu, media items), which uses our '<Button Style="{ThemeResource ButtonWideStyle}"...' There you find a first reference to the label, called '<Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>'. Label contains the text content. Text has a color... So next question, where is this "DefaultMenuItemContainerStyle" used? [CODE] <!-- ListView style to be used for main menu --> <Style x:Key="MainMenuListViewStyle" BasedOn="{ThemeResource DefaultListViewStyle}"> <Setter Property="ItemTemplate" Value="{ThemeResource MainMenuItemDataTemplate}"/> <Setter Property="DataStringProvider" Value="{ThemeResource MainMenuItemDataStringProvider}"/> <Setter Property="ItemContainerStyle" Value="{ThemeResource DefaultMenuItemContainerStyle}"/> </Style> [/CODE] Getting better, now let's check the ItemTemplate "MainMenuItemDataTemplate"... Well, we got it (finally!): [CODE] <DataTemplate x:Key="MainMenuItemDataTemplate"> <DockPanel x:Name="ItemControl" LastChildFill="True"> <Label x:Name="ItemLabel" DockPanel.Dock="Center" Content="{Binding [Name]}" Color="{ThemeResource TextColor}"/> </DockPanel> </DataTemplate> [/CODE] There is our label, using the Color "TextColor". When we now search for the definition of "TextColor" this leads us to the real color, defined inside "colors.xml" [CODE] <!-- White --> <ResourceWrapper x:Key="TextColor" Resource="White"/> [/CODE] This value you can change now to any other color, "Red", "Green", "#FFFFFF" (white), "#A0FFFFFF" (semi transparent white). As a rule of thumb, look into the .xaml files with suitable names, here "color.xaml" contains all definitions of main colors (or gradients). [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Skins and Design
Button foreground color
Contact us
RSS
Top
Bottom