在此处输入图像描述这是我的 xaml 代码:
ContentPage.ToolbarItems ToolbarItem Text="+" Priority="0" Order="Primary" Command="{Binding PrikaziCommand}" ToolbarItem ContentPage.ToolbarItems
如何通过xaml代码将文本颜色更改为所有平台?
在此处输入图像描述这是我的 xaml 代码:
ContentPage.ToolbarItems ToolbarItem Text="+" Priority="0" Order="Primary" Command="{Binding PrikaziCommand}" ToolbarItem ContentPage.ToolbarItems
如何通过xaml代码将文本颜色更改为所有平台?
如果要更改工具栏文本颜色,可以使用Navigation.Titleview
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TitleViewSample"
x:Class="TitleViewSample.MainPage">
<NavigationPage.TitleView>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Text="Your Title" Grid.Column="0" TextColor="White" FontSize="Large" VerticalOptions="Center" HorizontalOptions="FillAndExpand"></Label>
<StackLayout Grid.Column="1" HorizontalOptions="EndAndExpand" Orientation="Horizontal" Margin="0,5,5,5">
<Label Text="?" FontSize="Large" TextColor="Red" Margin="10" ></Label>
<Label Text="+" FontSize="Large" TextColor="Green" Margin="10" ></Label>
</StackLayout>
</Grid>
</NavigationPage.TitleView>
</ContentPage>
如果要更改工具栏颜色,请在导航到特定页面时添加此代码
MainPage = new NavigationPage(new YourPage());
((NavigationPage)MainPage).BarBackgroundColor = Color.FromHex("#19110F");