binding to width property in code behind

后端 未结 2 1109
一整个雨季
一整个雨季 2020-12-19 10:17

I have a situation where I need to create View box with one button. The xaml for this is as below: Please observe Width property of viewbox. The Width should be increased/de

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-19 10:36

    You can create the binding relatively easily in Code Behind:

    var widthBinding = new Binding("Value") { ElementName = "ZoomSlider" };
    
    _ScaleButton.SetBinding(FrameworkElement.WidthProperty, widthBinding);
    

提交回复
热议问题