例如,我要实现下面的一些信息的获取:但,在Conver函数里,怎么获取绑定源的接入口?
public class MyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
object oo = 绑定源.FindName(value.ToString());
string s1= 绑定源.ToolTip;
int Height= 绑定源.ActualHeight;
int Width= 绑定源.ActualWidth; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class MyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
object oo = 绑定源.FindName(value.ToString());
string s1= 绑定源.ToolTip;
int Height= 绑定源.ActualHeight;
int Width= 绑定源.ActualWidth; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
<MultiBinding Converter="{StaticResource conver1}">
<Binding ElementName="border1" Path="ToolTip"></Binding>
<Binding ElementName="绑定源的Name"></Binding>
<Binding ElementName="绑定目标的Name"></Binding>
</MultiBinding>然后,在Conver函数里,就可以使用:((System.Windows.UIElement)(values[1])).ToolTip;
((System.Windows.UIElement)(values[1])).ActualHeight;