看來,仍然無法綁定Silverlight 4中DataGridTemplateColumn的visibility屬性。我做了一些谷歌搜索,似乎有幾個帖子暗示它要做with the fact that it was not a DependencyObject以及this would change in SL4,但似乎並非如此。爲什麼我不能在Silverlight 4中綁定DataGridTemplateColumn的Visiblity?
爲了解決這個問題,我在datagrid加載的事件後面的代碼中做了它,但我很好奇爲什麼會出現這種情況?
以下是錯誤消息我得到(與返回能見度值轉換器):
{System.ArgumentException: Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Visibility'.
at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)
at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue)}
感謝您的幫助一如既往安東尼。 – Rodney 2010-08-09 00:36:39
太令人沮喪。 – 2011-05-23 23:08:00
同意。 Hopefull MS將來會製造這些依賴屬性。 – 2011-05-30 01:01:52