【发布时间】:2013-12-21 00:32:27
【问题描述】:
我在 XAML 中为我的 AppBatButton 使用下一个代码:
<AppBarButton Icon="Play" Label="Play" Click="btn_Click">
<AppBarButton.RenderTransform>
<CompositeTransform ScaleX="{Binding Path=ButtonsRenderSize}" ScaleY="{Binding Path=ButtonsRenderSize}"/>
</AppBarButton.RenderTransform>
</AppBarButton>
其中 ButtonsRenderSize 是在页面的 C# 部分声明的变量:
public static double ButtonsRenderSize { get; set; }
public MainPage()
{
InitializeComponent();
ButtonsRenderSize = 0.75;
}
问题是绑定不起作用。 RenderSize 仍然是 1。没有绑定它可以工作,但是当窗口不在全屏模式并且我有多个按钮时,我需要从代码中修改 RenderSize,所以绑定听起来是最好的主意。
【问题讨论】:
标签: c# wpf xaml data-binding binding