I am trying to create a GridSplitter which is mostly opaque, and then on mouseover, animates to become fully visible. Here's what I've tried:
Style:
<Style x:Key="SplitterStyle" TargetType="{x:Type GridSplitter}">
<Setter Property="Opacity" Value="0.2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GridSplitter}">
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
GridSplitter:
<GridSplitter
ResizeDirection="Columns"
Grid.Column="0"
Background="Red"
VerticalAlignment="Stretch"
Width="4"
Style="{StaticResource SplitterStyle}" />
I checked MSDN, and GridSplitter has all of the properties that I'm using, so it seems like it should be fine, but maybe I'm overlooking something obvious?
EDIT:
Is it possible to put a GridSplitter into another element? I changed my style to:
<Style x:Key="SplitterStyle" TargetType="{x:Type Border}">
<Setter Property="Opacity" Value="0.2" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
Then, I put the GridSplitter into a Border and applied the style to the border, instead:
<Border
Style="{StaticResource SplitterStyle}"
Background="{StaticResource WindowBorderBrush}"
VerticalAlignment="Stretch"
Width="4"
Grid.Column="0"
HorizontalAlignment="Right">
<GridSplitter ResizeDirection="Columns" Background="Red" ResizeBehavior="CurrentAndNext"/>
</Border>
The border works great! But now, the GridSplitter is nowhere to be found (the red background is no shown, the cursor doesn't change when I hover over the border, and there's nothing to drag to resize anything). Why is this?
EDIT:
OK, I found out that I have to specify a width for the GridSplitter. Also, I changed the background for the GridSplitter to transparent, because I was never planning on using red. Now, it displays and looks great, but it still doesn't actually resize anything :P How do I get it to actually be useful?
This is what I ended up with, which worked:
<Style x:Key="SplitterStyle" TargetType="{x:Type GridSplitter}">
<Setter Property="Opacity" Value="0.2" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
and
<GridSplitter
Background="{StaticResource WindowBorderBrush}"
VerticalAlignment="Stretch"
Width="4"
Grid.Column="0"
ResizeDirection="Columns"
Style="{StaticResource SplitterStyle}" />
I thought I tried exactly that at least once before even posting the first time, but I guess not. Anyway, it works great now.
Related
I'm trying to create a button in XAML with a mouse over trigger that turns its 0 margin to 0,0,0,5 but recently found a problem when I left the cursor on the edge-most of the button. The start and end actions constantly gets triggered and I end up with a button going up and down infinitely.
Some additional info:
I'm using Visual Studio 2017
The project is WPF
I think I could fix this this in c# if I applied a boolean requirement for the exit action to run only if the enter action finishes or goes a digit above the default value. I'll do this in the meantime but if you guys have any xaml-specific solution I would very much appreciate it as I wanted to leave the animations to xaml as much as possible.
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
From="0"
To="0.4"
Duration="0:0:0.2"
Storyboard.TargetProperty="Effect.Opacity"/>
<ThicknessAnimation
From="0"
To="0,0,0,5"
Duration="0:0:0.2"
Storyboard.TargetProperty="Margin"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
From="0.4"
To="0"
Duration="0:0:0.2"
Storyboard.TargetProperty="Effect.Opacity"/>
<ThicknessAnimation
From="0,0,0,5"
To="0"
Duration="0:0:0.2"
Storyboard.TargetProperty="Margin"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
You need additional container and reserved space for shift.
wrap your animation Border with Transparent Grid
assign name to border
move animation triggers to ControlTemplate level
add extra margin for border, which will be used as free space to shift up
adjust From/To ThicknessAnimation properties to use reserved margin property
add Storyboard.TargetName="{Border}" for story board elements (where {Border} is actual border name)
Complete button example
<Button Width="100" Height="50">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid Background="Transparent">
<Border x:Name="Border" BorderThickness="5" BorderBrush="Black" Margin="0,5,0,0" Background="Red">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" BlurRadius="8" Color="#FFB0E9EF"/>
</Setter.Value>
</Setter>
</Style>
</Border.Style>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation From="0" To="0.4" Duration="0:0:0.2" Storyboard.TargetName="Border"
Storyboard.TargetProperty="Effect.Opacity"/>
<ThicknessAnimation From="0,5,0,0" To="0,0,0,5" Duration="0:0:0.2" Storyboard.TargetName="Border"
Storyboard.TargetProperty="Margin"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0.4" To="0" Duration="0:0:0.2" Storyboard.TargetName="Border"
Storyboard.TargetProperty="Effect.Opacity"/>
<ThicknessAnimation From="0,0,0,5" To="0,5,0,0" Duration="0:0:0.2" Storyboard.TargetName="Border"
Storyboard.TargetProperty="Margin"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
I wanna change the border color of LoopingSelector so I copy the style definition of LoopingSelectorItem (as listed bleow) from Generic.xaml to my PhoneApplicationPage.Resources. And then change the Fill of Grid into Red.
Now the problem is that, when I open this app in simulator, the LoopingSelector does not show up immediately. But as soon as I touch the screen area where the selector should be, it shows up and the border color is what I want. This looks like an initialization problem, but I do not know what to do. I try to copy this style definition without any change from the original Generic.xaml, the problem still exists. Any one can help me with this problem?
<phone:PhoneApplicationPage.Resources>
<Style TargetType="primitives:LoopingSelectorItem">
<Setter Property="Foreground" Value="{StaticResource PhoneSubtleBrush}"/>
<Setter Property="Padding" Value="6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="root" CacheMode="BitmapCache" Background="Transparent" Padding="{TemplateBinding Padding}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Normal" To="Expanded" GeneratedDuration="0:0:0.33" />
<VisualTransition From="Expanded" To="Normal" GeneratedDuration="0:0:0.33" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="Expanded">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="Opacity" To="0.8" Duration="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="background" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
<DoubleAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="BorderBrush" Duration="0">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentControl" Storyboard.TargetProperty="Foreground" Duration="0">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border.RenderTransform>
<TranslateTransform x:Name="Transform"/>
</Border.RenderTransform>
<Grid>
<Rectangle x:Name="background" Margin="0" Opacity="0" Fill="Red" CacheMode="BitmapCache"/>
<Border x:Name="border" Opacity="0" BorderThickness="3" BorderBrush="{StaticResource PhoneSubtleBrush}">
<ContentControl x:Name="contentControl" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">
<ContentPresenter x:Name="contentPresenter" CacheMode="BitmapCache"/>
</ContentControl>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
I've just found myself having this exact same problem. The way I got round it was by taking the LoopingSelector and LoopingSelectorItem code from the Toolkit's source, rename them to CustomLoopingSelector and CustomLoopingSelectorItem. Then in my generic.xaml, but the Toolkit's default style for the LoopingSelector, but then add the style I wanted for the LoopingSelectorItem as the CustomLoopingSelectorItem's default style.
This has now given me the style I want, and doesn't blank out when coming back into the page. Might be worth a try for you.
This question already has an answer here:
Change ListBoxItem Background Color when mouse is over on the listBoxItem
(1 answer)
Closed 8 years ago.
I have a ListBox, and there are a few items. How can I change the Background of the ListBoxItem, when mouse hovers it? I tried with this code, but it returns error:
<Window.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="Opacity" Value="0.6" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Trigger.Setters>
<Setter Property="Opacity" Value="1.0" />
</Trigger.Setters>
</Trigger>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.3" Storyboard.TargetProperty="Background" To="Orange" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="Mouse.MouseLeave">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.3" Storyboard.TargetProperty="Background" To="White" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
Use a ColorAnimation instead of DoubleAnimation:
<ColorAnimation Duration="0:0:0.3"
Storyboard.TargetProperty="Background.(SolidColorBrush.Color)"
To="Orange" />
I have been trying to change the stroke thickness of my button, but I seem to be missing something. The basic idea is I want the button to look zoomed in, as I shrink the transparent stroke (border) around the rectangle.
Here are the variations that I have used:
<DoubleAnimation To="10"
Storyboard.TargetName="innerRectangle"
Storyboard.TargetProperty="(Rectangle.StrokeProperty).StrokeThickness">
</DoubleAnimation>
I have also used the following line:
<DoubleAnimation To="10"
Storyboard.TargetName="innerRectangle"
Storyboard.TargetProperty="StrokeThickness">
</DoubleAnimation>
And:
<DoubleAnimation To="10"
Storyboard.TargetName="innerRectangle"
Storyboard.TargetProperty="(Rectangle.StrokeThickness)">
</DoubleAnimation>
None of the above works.
The entirety of the code is as follow:
<Style x:Key="SecondaryButton" TargetType="Button">
<!--<Setter Property="Background" Value="LightSkyBlue"></Setter>
<Setter Property="Foreground" Value="Black"></Setter>-->
<Setter Property="Padding" Value="5"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent" x:Name="RootGrid">
<Border x:Name="Outline" BorderBrush="Transparent" BorderThickness="2">
<Rectangle x:Name="innerRectangle" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Stroke="Red"
StrokeThickness="15" Fill="LightSkyBlue"
RadiusX="15" RadiusY="15" />
</Border>
<ContentPresenter x:Name="Text" Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<!--<Storyboard>
<ColorAnimation To="Black" Storyboard.TargetName="Text" Storyboard.TargetProperty="(Button.Foreground).(SolidColorBrush.Color)"></ColorAnimation>
<ColorAnimation To="LightSkyBlue" Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)"></ColorAnimation>
</Storyboard>-->
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<!--<ColorAnimation To="LightBlue" Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)"></ColorAnimation>-->
<DoubleAnimation To="10"
Storyboard.TargetName="innerRectangle"
Storyboard.TargetProperty="(Rectangle.StrokeThickness)"
>
</DoubleAnimation>
<!--<ColorAnimation To="LightSkyBlue"
Storyboard.TargetName="innerRectangle"
Storyboard.TargetProperty="(Rectangle.Stroke).(SolidColorBrush.Color)">
</ColorAnimation>-->
<!--<ColorAnimation To="Red"
Storyboard.TargetName="Outline"
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
</ColorAnimation>-->
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation To="10"
Storyboard.TargetName="innerRectangle"
Storyboard.TargetProperty="StrokeThickness">
</DoubleAnimation>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Make sure you Enable Dependent Animations.
I'm creating a Windows store app which requests the Dark theme by default. This is great apart from one of the pages needs to be white. I placed everything inside a grid and changed the background to white.. everything is working fine, apart from my navigation button is styled as:
<Button Foreground="Black" x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}" />
{StaticResource BackButtonStyle} returns a white button (due to my Apps Dark theme), so the back button is invisible against the white background.
How can I change the colour of this back button to black? i.e so it will show a black arrow inside a black circle.
I've tried creating my own style in StandardStyles.xaml without any joy:
<Style x:Key="PortraitBackButtonStyle" TargetType="Button" BasedOn="{StaticResource BackButtonStyle}">
<Setter Property="Margin" Value="26,0,26,36"/>
</Style>
Thanks!
Put this style in StandardStyles.xaml file and use it in your back button
<Color x:Key="Color1">#ffffff</Color>
<Color x:Key="Color2">#000000</Color>
<Color x:Key="Color3">#666666</Color>
<SolidColorBrush x:Key="MyBackButtonNormalBrush" Color="{StaticResource Color2}"/>
<SolidColorBrush x:Key="MyBackButtonBackgroundBrush" Color="{StaticResource Color1}"/>
<SolidColorBrush x:Key="MyBackButtonHoverBrush" Color="{StaticResource Color3}"/>
<Style x:Key="MyBackButtonStyle" TargetType="Button">
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Width" Value="48"/>
<Setter Property="Height" Value="48"/>
<Setter Property="Margin" Value="36,0,36,36"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="FontFamily" Value="Segoe UI Symbol"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="56"/>
<Setter Property="AutomationProperties.AutomationId" Value="BackButton"/>
<Setter Property="AutomationProperties.Name" Value="Back"/>
<Setter Property="AutomationProperties.ItemType" Value="Navigation Button"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource MyBackButtonHoverBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource MyBackButtonNormalBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource MyBackButtonNormalBrush}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="ArrowGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0"/>
<DoubleAnimation
Storyboard.TargetName="NormalGlyph"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0"/>
<DoubleAnimation
Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Margin="-1,-16,0,0">
<TextBlock x:Name="BackgroundGlyph" Text="" Foreground="{StaticResource MyBackButtonBackgroundBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonGlyph}" Foreground="{StaticResource MyBackButtonNormalBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="" Foreground="{StaticResource MyBackButtonBackgroundBrush}" Opacity="0"/>
</Grid>
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"/>
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
if Your Background is white
You Can write at Back Button Property the Following Code :
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
RequestedTheme="Light"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
There is an obvious solution – to re-style controls. But you don't want to type style name every time you need to add control to UI. Also you usually use input controls on a dark background so you don’t even need two different styles. In this case a different approach can be used.
The solution:
First, open:
C:\Program Files (x86)\Windows Kits\8.0\Include\winrt\xaml\design\themeresources.xaml
and search for "Dark" ResourceDictionary declaration. Copy all SolidColorBrush object definitions associated with buttonsa and finally paste all the brushes into your resource dictionary, and you can use it.
Source:: Mixing themes in XAML Metro apps
To apply Light theme/Dark theme(as per your requirement), just copy the following code into StandardStyles.xaml and do change the respective resoluce
1)For Light Theme
<SolidColorBrush x:Key="AppBarBackgroundThemeBrushLight" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="AppBarBorderThemeBrushLight" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="AppBarItemBackgroundThemeBrushLight" Color="Transparent" />
<SolidColorBrush x:Key="AppBarItemDisabledForegroundThemeBrushLight" Color="#66000000" />
<SolidColorBrush x:Key="AppBarItemForegroundThemeBrushLight" Color="#FF000000" />
<SolidColorBrush x:Key="AppBarItemPointerOverBackgroundThemeBrushLight" Color="#3D000000" />
<SolidColorBrush x:Key="AppBarItemPointerOverForegroundThemeBrushLight" Color="#FF000000" />
<SolidColorBrush x:Key="AppBarItemPressedForegroundThemeBrushLight" Color="#FFFFFFFF" />
For Dark Theme
<SolidColorBrush x:Key="AppBarBackgroundThemeBrushDark" Color="{StaticResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="AppBarBorderThemeBrushDark" Color="{StaticResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="AppBarItemBackgroundThemeBrushDark" Color="{StaticResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="AppBarItemDisabledForegroundThemeBrushDark" Color="{StaticResource SystemColorGrayTextColor}" />
<SolidColorBrush x:Key="AppBarItemForegroundThemeBrushDark" Color="{StaticResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="AppBarItemPointerOverBackgroundThemeBrushDark" Color="{StaticResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="AppBarItemPointerOverForegroundThemeBrushDark" Color="{StaticResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="AppBarItemPressedForegroundThemeBrushDark" Color="{StaticResource SystemColorButtonFaceColor}" />
and accordingly change
AppBarItemForegroundThemeBrush to AppBarItemForegroundThemeBrushLight/AppBarItemForegroundThemeBrushDark
refer these links for customising the App Bar
Here and Here
It'll help you.
Within the code you could change the style via code after the controls have been initialized.
Cheers
Mark