Hello
Not sure if this has been reported, but when i change the Visibility of a Button control i get the following error:
ExceptionObject {System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at System.Windows.DependencyObject.MethodEx(String methodName, CValue[] cvData)
at System.Windows.UIElement.ReleaseMouseCapture()
at System.Windows.Controls.Primitives.ButtonBase.ReleaseMouseCaptureInternal()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)} System.Exception
Changing the Visibility of a TextBox and TextBlock are fine
Here the section of my code, it's pretty straight forward:
public static readonly DependencyProperty CurrentModeProperty = DependencyProperty.Register("CurrentMode", typeof(ControlMode), typeof(MyClass), new PropertyChangedCallback(CurrentModeChangedCallback));
private static void CurrentModeChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
MyClass ctrl = (MyClass)obj;
ctrl.butSettings.Visibility =
Visibility.Collapsed;ControlMode oldValue = (ControlMode)args.OldValue;ControlMode newValue = (ControlMode)args.NewValue;
ControlModeChangedEventArgs e = new ControlModeChangedEventArgs(newValue);
ctrl.OnControlModeChanged(e);
}
hope that helps
boardz