Hi,
I have an issue with busy indicator & textbox focus. I have tried the fix from http://www.telerik.com/help/silverlight/radbusyindicator-how-to-restore-the-focus.html. This throws an error while running the application. Please help..
Error is:
System.Windows.Markup.XamlParseException occurred
LineNumber=38
LinePosition=193
Message=Set property 'Controls.Helper.EnsureFocus' threw an exception. [Line: 38 Position: 193]
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Iatric.SAM.Shell.Login.InitializeComponent()
at Iatric.SAM.Shell.Login..ctor()
InnerException: System.ArgumentException
Message=Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.Boolean'.
StackTrace:
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 MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)
at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj,
XamlPropertyToken inProperty, XamlQualifiedObject& inValue)
InnerException:
My Helper Class:
Public Class Helper
Private Shared Sub OnEnsureFocusChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
If Not CBool(e.NewValue) Then
TryCast(d, Control).Focus()
End If
End Sub
Public Shared Function GetEnsureFocus(ByVal obj As DependencyObject) As Boolean
Return CBool(obj.GetValue(EnsureFocusProperty))
End Function
Public Shared Sub SetEnsureFocus(ByVal obj As DependencyObject, ByVal value As Boolean)
obj.SetValue(EnsureFocusProperty, value)
End Sub
Public Shared ReadOnly EnsureFocusProperty As DependencyProperty = DependencyProperty.RegisterAttached("EnsureFocus", GetType(Boolean), GetType(Helper), New PropertyMetadata(Nothing, AddressOf OnEnsureFocusChanged))
End Class
I have an issue with busy indicator & textbox focus. I have tried the fix from http://www.telerik.com/help/silverlight/radbusyindicator-how-to-restore-the-focus.html. This throws an error while running the application. Please help..
Error is:
System.Windows.Markup.XamlParseException occurred
LineNumber=38
LinePosition=193
Message=Set property 'Controls.Helper.EnsureFocus' threw an exception. [Line: 38 Position: 193]
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Iatric.SAM.Shell.Login.InitializeComponent()
at Iatric.SAM.Shell.Login..ctor()
InnerException: System.ArgumentException
Message=Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.Boolean'.
StackTrace:
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 MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)
at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj,
XamlPropertyToken inProperty, XamlQualifiedObject& inValue)
InnerException:
My Helper Class:
Public Class Helper
Private Shared Sub OnEnsureFocusChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
If Not CBool(e.NewValue) Then
TryCast(d, Control).Focus()
End If
End Sub
Public Shared Function GetEnsureFocus(ByVal obj As DependencyObject) As Boolean
Return CBool(obj.GetValue(EnsureFocusProperty))
End Function
Public Shared Sub SetEnsureFocus(ByVal obj As DependencyObject, ByVal value As Boolean)
obj.SetValue(EnsureFocusProperty, value)
End Sub
Public Shared ReadOnly EnsureFocusProperty As DependencyProperty = DependencyProperty.RegisterAttached("EnsureFocus", GetType(Boolean), GetType(Helper), New PropertyMetadata(Nothing, AddressOf OnEnsureFocusChanged))
End Class