uwp - 如何在 Uno 平台中将 RadialGradientBrush 与 Storyboard 一起使用
问题描述
我想在 Uno 平台中将 RadialGradientBrush 与 Storyboard 一起使用。
我用“Microsoft.UI.Xaml.Media”来显示RadialGradientBrush,显示没问题。
但是当我将 RadialGradientBrush 与 Storyboard 一起使用时,Storyboard 的TargetProperty将显示“无法解析 TargetProperty ”。
谁能帮我解决这个问题,tks...
主页.xml:
<Page
x:Class="App7.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App7"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.UI.Xaml.Media"
mc:Ignorable="d">
<Page.Resources>
<Storyboard x:Name="Storyboard1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(media:RadialGradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="path1">
<EasingDoubleKeyFrame KeyTime="0:0:8" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:11.1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Page.Resources>
<Grid x:Name="LayoutRoot" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Width="1500" Height="1000">
<Grid Margin="181,120,679,590" ScrollViewer.VerticalScrollBarVisibility="Disabled" Width="640" Height="290">
<Path x:Name="path1" Data="M20.5,0.5 L20.5,131.1568 L19.245193,130.66107 C12.863921,128.07494 6.880846,125.19048 1.3586025,122.0434 L0.5,121.54227 L0.5,10.114529 L1.3586025,9.6134071 C6.880846,6.4663239 12.863921,3.5818634 19.245193,0.99572372 z" HorizontalAlignment="Left" Margin="61,62.172,0,86.172" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" Width="21">
<Path.Fill>
<media:RadialGradientBrush x:Name="radial">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="White" Offset="0.842"/>
</media:RadialGradientBrush>
</Path.Fill>
</Path>
</Grid>
</Grid>
</Page>
Storyboard1.Begin();
当我在 MainPage.xaml.cs 中调用时出现错误消息 :
System.Exception: 'No installed components were detected.
Cannot resolve TargetProperty (Shape.Fill).(media:RadialGradientBrush.GradientStops)[1].(GradientStop.Offset) on specified object.'
解决方案
推荐阅读
- flutter - 我怎样才能使自定义粘性标题中的标题彼此粘在一起而不是在颤动中重叠?
- flutter - 如何在firestore中向我的数组/列表添加时间戳?
- wpf - 在 WPF 项目中包含 UWP 项目会引发运行时错误
- excel - 遍历命名范围并选择行和列
- google-cloud-platform - 来自托管 Cloud Run 的 JDBC 连接?
- python-3.x - 将字符串附加到字符串列表
- cognos-11 - 我想创建交叉表来计算每年的项目总数和活动项目
- r - R SHINY:根据 selectInput/numericInput 选项清除/更新 mainPanel
- javascript - 如何添加事件侦听器以触发服务器端电子邮件功能?
- java - 如何以确定的顺序遍历 Guava 图?