I'm displaying a XamDialogWindow but when I minimize it I get the following unhandled exception:
> [Window Title]
> Visual Studio Just-In-Time Debugger
> [Main Instruction]
>An unhandled exception ('Unhandled Error in Silverlight Application
>Code: 4004
>Category: ManagedRuntimeError
>Message: System.ArgumentException: Value does not fall within the expected range.
> at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
> at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
> at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
> at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
>') occurred in iexplore.exe [6844].
>
>The Just-In-Time debugger was launched without necessary security permissions. To debug this process, the Just-In-Time debugger must be run as an Administrator. Would you like to debug this process?
>[V] View process details [Yes, debug iexplore.exe] [No, cancel debugging]
>[Expanded Information]
>Process Name: C:\Program Files\Internet Explorer\iexplore.exe
(See also attached screenshot).
I have repeated this both in my main project and in a test project that contains nothing else other than a button to display the child window.
This only repeats if you have the "Header" object set. Remove the header/title text and the crash doesn't happen. Removing the line:
Content="{TemplateBinding Header}"
From the style definition also gets round the problem. We'll go with this as we're tweaking the style of the window to match our projects look and feel anyway.
The project can be found here:
https://docs.google.com/open?id=0ByA9Ma2avsZqaXZlci1vTjNrcE0
Thanks. As we have a work round for this it's not an urgent problem.
The more urgent problem we have is this one - BusyIndicator not displaying when view is displayed inside a XamDialogWindow
Hello Chris,
After some investigation it turns out that the Template for the xamDialogWindow has multiple ContentControl's and each is using the Header and HeaderTemplate of the xamDialogWindow so the exception is happening because SL doesn't allow those 2 elements to contain the same element. If you're going to use an element then it would be better to set the HeaderTemplate to a DataTemplate that provides the TextBlock and set the Header to the string or something that you will bind to within that DataTemplate.
Hope this helps you.