[UWP]设置x:在Setter中加载 [英] [UWP] Set x:Load in Setter
问题描述
如
所述:
>在 VisualState ,使用
Setter 或
Storyboard 以x:Load元素为目标的动画。
>In a VisualState, use a Setter or Storyboard animation that targets the x:Load element.
我的问题是如何在设置器中设置x:加载。
My question is how to set x:Load in a setter.
提前致谢!
推荐答案
您好gillesberger_p,
Hi gillesberger_p,
"
在 的的 VisualState ,
使用 Setter 或 Storyboard 动画
,以x:Load元素为目标。"
" In a VisualState, use a Setter or Storyboard animation that targets the x:Load element."
>> " 我的
问题是如何设置x:在设置器中加载。 "
根据我的理解,这句话并不意味着直接为"加载元素",表示 可以通过"Setter或Stroyboard动画"加载
卸载元素。我使用以下代码对其进行了测试:
According to my understanding, that sentence doesn’t mean to set "x:load" directly for "Loading Elements", it means an unload element can be loaded through "a Setter or Stroyboard animation". I tested it with the code below:
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowSizeStates">
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600" />
</VisualState.StateTriggers>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--Use setter to load the button-->
<Setter Target="TestButton.Foreground" Value="Black" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Button Name="TestButton" Content="TestButton" x:Load="False" />
</StackPanel>
顺便说一句,thers是"XamlDeferLoadStrategy "演示了如何使用此属性。
x:XamlDeferLoadStrategy 行为类似于x:大部分加载。
By the way, thers is a sample of "XamlDeferLoadStrategy" demonstrates the use of this property.
x:XamlDeferLoadStrategy behaves like x:load mostly.
" 使用 x:Load =" False"
是
等效于 x:DeferLoadStrategy =" Lazy"
,
但是可以根据需要卸载用户界面。请参阅 x:加载
属性 了解更多信息。 "(参考
here )
"Using x:Load="False"
is
equivilent to x:DeferLoadStrategy="Lazy"
,
but provides the ability to unload the UI if required. See the x:Load
attribute for more info."(Refered from
here)
该示例展示了如何通过"Storyboad动画"实现元素。我希望它对您有所帮助。 />
The sample shows how to realize the element by "Storyboad animation". I hope it would be helpful to you.
最好的问候!
Jason
这篇关于[UWP]设置x:在Setter中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!