Binding custom dependency property to custom WPF style

依然范特西╮ 提交于 2019-11-30 20:04:29

In the style, we can use a standard Binding with a RelativeSource to set up the property.

<ProgressBar Name="ProgressBar"
             Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Progress}"
             Minimum="0"
             Maximum="100" />

Then, in the window we just add Progress="50" or a binding to somewhere else.

You will also need to set the Button's background to transparent, or change some manner of the layout, in order to see it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!