Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将控件的 canvas.zindexproperty 绑定到类属性名称 zindex。
我试过了,但它不工作
Binding zIndexBinding = new Binding("zIndex"); indicator.SetValue(Canvas.ZIndexProperty, zIndexBinding);
我不知道如何做到这一点,所以任何帮助将不胜感激。谢谢你
SetValue是设置一个简单的值而不是绑定。您可以SetBinding在使用 a 时改用Binding:
SetValue
SetBinding
Binding
indicator.SetBinding(Canvas.ZIndexProperty, zIndexBinding);
请注意,您将需要以及Path您提供的Source、ElementName、DataContext等来解析路径适用的对象。
Path
Source
ElementName
DataContext