Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug #4002 error when changing Visibilty
2 replies. Latest Post by boardz on May 16, 2008.
(0)
boardz
Member
15 points
12 Posts
05-14-2008 4:09 PM |
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));
{
ctrl.butSettings.Visibility =
ctrl.OnControlModeChanged(e);
}
hope that helps
Yi-Lun L...
All-Star
25052 points
2,747 Posts
05-16-2008 3:58 AM |
Hello, from the stack trace, it looks like you're setting the Button's Visibility to Collapsed in its Click event handler. This is a known issue. But I just tried that on an internal Beta2 build, and it works fine. So hopefully this issue has already been fixed. Meanwhile you can set Opacity to 0 or set Both Width and Height to 0.
05-16-2008 5:15 AM |
Hi Yi-Lun thanks for the reply. Yes i have a work around at the moment, in fact the bug has led me to a better design.
internal Beta2 hey! Do we proles get to have a squiz with Beta2 or do we have to wait for the Release.