简体   繁体   English

Uno 材质底部导航栏

[英]Uno Material bottomNavigationBar

I am implementing the bottomNavigationBar on the Uno Platform for my app.我正在为我的应用程序在 Uno 平台上实现 bottomNavigationBar。 I have everything else working- but am having trouble changing either the color or the opacity of the ripple effect when an icon is pressed.我有其他一切工作 - 但是在按下图标时无法更改波纹效果的颜色或不透明度。 I either need to change the opacity or the color of the effect.我需要更改效果的不透明度或颜色。 What is the name of the property I need to modify- and is it a color or percentage?我需要修改的属性的名称是什么?它是颜色还是百分比? Thanks for your help!谢谢你的帮助!

Here is a sample of the styles I have tried:这是我尝试过的 styles 的示例:

        <SolidColorBrush x:Key="NavigationViewItemForegroundSelected" Color="Green"/>
        <SolidColorBrush x:Key="NavigationViewItemForegroundSelectedPointerOver" Color="Green"/>
        <SolidColorBrush x:Key="NavigationViewItemForegroundPressed" Color="Green"/>
        <SolidColorBrush x:Key="NavigationViewItemForegroundSelectedPressed" Color="Green"/>
        <SolidColorBrush x:Key="NavigationViewSelectionIndicatorForeground"  Color="Blue" />
        <Color x:Key="MaterialPrimaryColor">Green</Color>
        <Color x:Key="MaterialSecondaryColor">LightGreen</Color>
        <Color x:Key="MaterialBottomNavForegroundColor">Green</Color>
        <Color x:Key="MaterialBottomNavUncheckedForegroundBrush">Blue</Color>
        <SolidColorBrush x:Key="MaterialBottomNavBackgroundBrush" Color="#FFF2F2F2"/>

The resource to change the ripple effect color is MaterialBottomNavPressedBrush更改波纹效果颜色的资源是MaterialBottomNavPressedBrush

Here's how you can find out which resources apply where:您可以通过以下方式了解哪些资源适用于何处:

  1. Look up the style on github在github上查找样式
  2. Find in the XAML template where the resource is used在XAML模板中找到资源使用的地方
  3. Note the name注意名字
  4. Override it in your application's XAML在应用程序的 XAML 中覆盖它

Here's where it is for this example github link这是此示例github 链接的位置

So- I figured out the issue- I needed both MaterialBottomNavPressedBrush and MaterialBottomNavUncheckedForegroundBrush.所以-我发现了问题-我需要 MaterialBottomNavPressedBrush 和 MaterialBottomNavUncheckedForegroundBrush。 Because of my color choices- if I left one out- it defaulted to white and you could not see it.由于我的颜色选择——如果我遗漏了一种——它默认为白色,你看不到它。 Thanks to matfillion for pointing me in the right direction.感谢 matfillion 为我指明了正确的方向。 Here is my example code:这是我的示例代码:

<Color x:Key="MaterialPrimaryColor">Blue</Color>
<SolidColorBrush x:Key="MaterialColor">Yellow</SolidColorBrush> 
<SolidColorBrush x:Key="MaterialBottomNavPressedBrush" Color="{ThemeResource MaterialColor}" Opacity="0.10" /> 
<SolidColorBrush x:Key="MaterialBottomNavUncheckedForegroundBrush" Color="{ThemeResource MaterialPrimaryColor}" Opacity=".50" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM