Change Color of Segoe UI Font Button Windows 8 - xaml

How can I change it so that any button I create for my Windows 8 app has a differently-colored Segoe UI glyph than the default (white)? I tried the following to no avail:
<Button Style="{StaticResource AppBarButtonStyle}"
AutomationProperties.Name="Button" Content="">
<Button.ContentTemplate>
<DataTemplate>
<Path Fill="red"/>
</DataTemplate>
</Button.ContentTemplate>
</Button>
My hopes were that this would create a solid red circle for a button rather than a white one, but it renders nothing at all instead. Help greatly appreciated!

Use Foreground property.
<Button Style="{StaticResource AppBarButtonStyle}" Foreground="Red"
AutomationProperties.Name="Button" Content="" />

Related

Button appears all black in dark theme - Windows 11 (WinUi 3)

I am develop a new app for Windows 11 with WinUi 3 and in my MainPage the button appears all black in dark theme:
Why this happen?
This is a resume of my code:
<Window
<Grid Name="Main" RowDefinitions="Auto,*">
<RelativePanel Grid.Row="0"
Background="{ThemeResource SystemControlAcrylicWindowBrush}">
<TextBlock Name="TextBlock_AAA"
Text="AAA">
</RelativePanel>
<RelativePanel Grid.Row="1">
<Button Name="Button_AAA"
Content="AAA"
Click="AAA_Click"/>
</RelativePanel>
</Grid>
</Window>
#Luís, you're putting your UI directly in your window which is why it is not being styled.
Add a Blank Page (from the WinUI tab in VisualStudio) called something like "MainPage" and move your Grid into the XAML for the Page.
In the XAML for your main window, simply put <local:MainPage/> as the only content.
Now your button will look like the one in the comment by #nico-zhu-msft

OxyPlot in Xamarin Forms WPF project, how to change tracker text color

I'm using OxyPlot in a Xamarin Forms project.
In WPF, the tracker (popup when I click on a datapoint) has a white background with yellow text, making it impossible to see.
In UWP however, it is just fine with a yellow background and black text.
How can I change the font color of the tracker to black?
xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
<oxy:PlotView Model="{Binding MyModel}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
</oxy:PlotView>
You can change the default colors of Oxyplot Tracker by modifying the Control Template. For example,
<oxy:PlotView Height="500" Width="500" Model="{Binding MyModel}">
<oxy:PlotView.DefaultTrackerTemplate>
<ControlTemplate>
<oxy:TrackerControl Position="{Binding Position}" LineExtents="{Binding PlotModel.PlotArea}">
<oxy:TrackerControl.Background>
<SolidColorBrush Color="LightBlue" />
</oxy:TrackerControl.Background>
<oxy:TrackerControl.Content>
<TextBlock Text="{Binding}" Margin="7" Foreground="Black" />
</oxy:TrackerControl.Content>
</oxy:TrackerControl>
</ControlTemplate>
</oxy:PlotView.DefaultTrackerTemplate>
</oxy:PlotView>
Of course, you can set the binding as well in the above, but for the sake of example, given the color directly in above example.

Horizontal context menu with icons Windows phone 8

I am trying to add a context menu which shows menu items horizontally. My sample code:
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<StackPanel Orientation="Horizontal">
<toolkit:MenuItem Tap="CallMenuItem_tapped">
<toolkit:MenuItem.Header>
<Image Height="50"
Stretch="Uniform"
Source="Assets/icon1.png" />
</toolkit:MenuItem.Header>
</toolkit:MenuItem>
<toolkit:MenuItem Tap="ChatMenuItem_tapped">
<toolkit:MenuItem.Header>
<Image Height="50"
Stretch="Uniform"
Source="Assets/icon2.png" />
</toolkit:MenuItem.Header>
</toolkit:MenuItem>
<toolkit:MenuItem Tap="OtherMenuItem_tapped">
<toolkit:MenuItem.Header>
<Image Height="50"
Stretch="Uniform"
Source="Assets/icon3.png" />
</toolkit:MenuItem.Header>
</toolkit:MenuItem>
</StackPanel>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
I am facing some problems. First of all when I tap a menu item the specific event is called but the menu remains open. As I am showing all the menu items in one line(horizontally), I am unable to fix the height and width of context menu. Is there a better way to add a horizontal context menu using icons?
I would suggest you to use the ItemsPanel property to set the layout as horizontal stack panel. And if you still face any issues then you can manually close the context menu using the IsOpen property. Hope this helps you.

Windows phone 8 Button style is transparent

My button looks like a text field instead of a button. Here's a screenshot:
Here's the code:
<Button FontWeight="Bold" Click="setWallpaper" Foreground="black" FontSize="35"
Margin="62,560,127,48" >Set Lockscreen</Button>
How do I fix it and make it look like a good old button?
Looks like the problem is that you have an image as your background and the button is transparent so it is showing the image. Just change your button background to White and it should fix it
<Button FontWeight="Bold" Click="setWallpaper" Foreground="Black" FontSize="35" Background="White" Margin="62,560,127,48" >Set Lockscreen</Button>

Windows phone 8 viewport control

I try to understand how windows phone viewport control Bounds work.
So i can give
viewport.Bunds = new Rect(x,y,width, height);
but what that bound stand for is it a scrollable area in the viewport.
Can anyone give me a working simple example of it cause whenever i try to use this parameter i can't scroll in viewport whatsover
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0">
<ViewportControl Name="tuzik" Bounds="0,0,300,400" Margin="66,117,20,41" >
<Canvas Name="canvas">
<Image Name="TestImage" Source="Assets\testimage.jpg"
HorizontalAlignment="Left" VerticalAlignment="Top"
Canvas.Left="-379" Canvas.Top="-769" Stretch="Fill" />
</Canvas>
</ViewportControl>
<Rectangle x:Name="rect" Width="300" Height="400" Margin="60,111,63,0" Stroke="Aqua" />
</Grid>
I believe your problem is the Canvas within the ViewportControl. Canvas does not expand to fill the ViewportControl and will not expand to contain the contents, either. You have to set a Width and Height on the Canvas.
(At least, that's how I have mine setup.)