.net 如何使用从代码behing到WPF的变量(string/integer/double)
如何从代码behing到WPF使用variablestring/integer/double 例如,在我的情况下,我有这个故事板.net 如何使用从代码behing到WPF的变量(string/integer/double),.net,wpf,vb.net,.net,Wpf,Vb.net,如何从代码behing到WPF使用variablestring/integer/double 例如,在我的情况下,我有这个故事板 <Storyboard x:Key="volumerecdown"> <DoubleAnimation Duration="00:00:00.5" AccelerationRatio="0.5" DecelerationRatio="0.5" Storyboard.
<Storyboard x:Key="volumerecdown">
<DoubleAnimation Duration="00:00:00.5" AccelerationRatio="0.5" DecelerationRatio="0.5"
Storyboard.TargetProperty="Height" To="STRING_FROM_CODE_BEHIND"/>
</Storyboard>
但不起作用您必须使用属性
Private _height_rec As Integer
Public Property height_rec As Integer
Get
Return _height_rec
End Get
Set(ByVal value As Integer)
_height_rec = value
End Set
End height_rec
在xaml中输入以下内容:
<Storyboard x:Key="volumerecdown">
<DoubleAnimation Duration="00:00:00.5" AccelerationRatio="0.5" DecelerationRatio="0.5"
Storyboard.TargetProperty="Height" To="{Binding height_rec}"/>
</Storyboard>
仍然不起作用,必须用End属性替换End height_rec,没有错误,但情节提要没有任何作用
<Storyboard x:Key="volumerecdown">
<DoubleAnimation Duration="00:00:00.5" AccelerationRatio="0.5" DecelerationRatio="0.5"
Storyboard.TargetProperty="Height" To="{Binding height_rec}"/>
</Storyboard>