【发布时间】:2011-08-26 17:43:16
【问题描述】:
我有一种情况,我需要用一个按钮创建视图框。用于此的 xaml 如下: 请观察 viewbox 的 Width 属性。宽度应根据滑块增加/减少(向右移动增加它,向左移动减少它)。如下所示,我知道如何在 xaml 中执行此操作,并且效果很好。但我的要求是能够在后面的代码中创建视图框并为其分配属性。
<WrapPanel x:Name="_wrpImageButtons" Grid.IsSharedSizeScope="True"
ScrollViewer.CanContentScroll="True" d:LayoutOverrides="Height"
Margin="5">
<Viewbox x:Name="_ScaleButton"
Width="{Binding Value, ElementName=ZoomSlider}" Stretch="Fill">
<CustomButton:_uscVCARSImagesButton x:Name="_btnImage1"/>
</Viewbox>
</WrapPanel>
谢谢。
【问题讨论】:
标签: wpf binding code-behind