如何引用XAML当前对象 [英] How to reference current object in XAML
问题描述
我不能'弄清楚如何引用在XAML文件XAML文件中定义的当前实例对象。
I cant' figure out how to reference the current instance object defined by the XAML file in the XAML file.
我有一个转换器,我想发在当前实例作为参数对象。
I have a converter that I want to send in the current instance as the parameter object.
{Binding Path=<bindingObject>, Converter={x:Static namespace:Converter.Instance}, ConverterParameter=this}
在此$ C C本$转换为字符串,而不是一个引用当前实例对象。
In this code this is converted to a string instead of a reference to the current instance object.
感谢
约翰·
推荐答案
从技术上说,ConverterParameter不是一个DependencyProperty的,所以你不能绑定到它。这将是很好做ConverterParameter = {绑定的ElementName =这个},但是你不能绑定到非依赖项属性。
Technically, the ConverterParameter is not a DependencyProperty, so you can't bind to it. It would be nice to do a ConverterParameter={Binding ElementName=this}, but you can't bind to a non-dependency property.
不过,有人弄清楚如何做到这一点在这里 。但是,这是一个有点复杂。
But, someone figure it out how to do it here. This is however a bit complicated.
这篇关于如何引用XAML当前对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!