This is a migrated thread and some comments may be shown as answers.

Value does not fall within expected range since upgrade to latest version

8 Answers 244 Views
Window
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 21 Jul 2011, 02:09 PM
I have a RadWindow which I've placed in the location I want it on my form. The RadWindow is a popup-style action menu which is displayed when the user clicks on a button. This was working fine until the latest update. Now when I call RadWindow.Show, I get a "value does not fall within expected range" on the RadWindow. The RadWindow also always displays regardless of if closed or not (I call RadWindow.Close from the Loaded event for the form and the window does not disappear)
The RadWindow contains a scrollviewer and a RadTreeView

There are no named elements in the treeview

There are no other 'Popup' elements visible at the time of calling RadWindow.Show

Looks like the 'content' property is throwing the error on the RadWindow

Stack trace:
   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
   at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
   at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
   at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
   at System.Windows.Controls.ContentPresenter.set_Content(Object value)
   at Telerik.Windows.Controls.InternalWindow.PopupWindowHost.Setup(IWindowDragAware window)
   at Telerik.Windows.Controls.InternalWindow.WindowHostFactory.GetWindowHost(WindowBase window)
   at Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal)
   at Telerik.Windows.Controls.RadWindow.Show()

Any ideas? I can't find any documentation that suggest any breaking changes of this sort in the latest version
I did see in the docs that it recommends not using a RadWindow as a visual element in XAML, but this seems to have worked in the past so I didn't change it

8 Answers, 1 is accepted

Sort by
0
Charles
Top achievements
Rank 1
answered on 21 Jul 2011, 02:31 PM
I've managed to fix it by making a UserControl inherit from the RadWindow and creating a new instance of this control which I hide/show instead of declaring the window in the XAML on the main page.
I suppose this is more the intended usage of the RadWindow

Thanks
0
Brad
Top achievements
Rank 2
answered on 25 Jul 2011, 03:06 PM
I'm also having this problem.  Is there is any information on why it's occurring?  We've got several RadWindows on several solutions that are failing due to this.

Exception:  
{System.ArgumentException: Value does not fall within the expected range." & vbCrLf & "
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)" & vbCrLf & "
at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)" & vbCrLf & "
at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)" & vbCrLf & "
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)" & vbCrLf & "
at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)" & vbCrLf & "
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)" & vbCrLf & "
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)" & vbCrLf & "
at System.Windows.Controls.ContentPresenter.set_Content(Object value)" & vbCrLf & "
at Telerik.Windows.Controls.InternalWindow.PopupWindowHost.Setup(IWindowDragAware window)" & vbCrLf & "
at Telerik.Windows.Controls.InternalWindow.WindowHostFactory.GetWindowHost(WindowBase window)" & vbCrLf & "
at Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal)" & vbCrLf & "
at Telerik.Windows.Controls.RadWindow.Show()" & vbCrLf & "
at SLFrontDesk.WorkOrder.OpenWindow()" & vbCrLf & "
at SLFrontDesk.TodaysActivity.lnkWorkOrder_Click(Object sender, RoutedEventArgs e)" & vbCrLf & "
at System.Windows.Controls.Primitives.ButtonBase.OnClick()" & vbCrLf & "
at System.Windows.Controls.HyperlinkButton.OnClick()" & vbCrLf & "
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)" & vbCrLf & "
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)" & vbCrLf & "
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}
0
Charles
Top achievements
Rank 1
answered on 25 Jul 2011, 03:12 PM
Hi Brad,
    I've read in other posts that this is due to duplicate names in the Popup namescope

Are you declaring your popup windows in XAML inline with the app XAML or as a UserControl?

I moved my declaration out of my form XAML and into a UserControl and ensured that only one radwindow instance with this content was active at one time.
0
Brad
Top achievements
Rank 2
answered on 25 Jul 2011, 03:39 PM
Yep, the RadWindow is broken with this new release Q2 2011 release.  Simple XAML declarations of the RadWindow break at the Show() event call in the code behind.  If we simply add a RadWindow to a XAML page we notice several things happening:

1) It's already open
2) It cannot be closed
3) It cannot be moved
4) The "Show" event breaks

I'm sure there are other problems, but I'm not going to dig any further.  We either have to revert back to the older version or wait for them to fix this.  Here was their response:  


"We remade big part of RadWindow and decided that this is the correct way to do things. Previously when RadWindow was declared in XAML we were removing it from its Parent and put it in a popup then show it. Clients tend to bind elements in the window to another XAML element and this binding getting broken and there were also other problems like panels layout is refreshed because of removing the window etc...
We believe that it is better practice to either create RadWindow in code behind or use it as a root element of a UserControl especially in WPF as there it is supposed that new windows are always root elements. So that is the reason that we changed the way RadWindow works when declared in XAML.

We are sorry for the caused inconvenience. Let us know if you have further questions.

@OrchidERP-- Could you provide some more info on the window disappearing on maximize.

Regards,
Boyan 
the Telerik team"
0
Charles
Top achievements
Rank 1
answered on 25 Jul 2011, 06:57 PM
Nice, well I thought there was a breaking change - I suppose both approaches are viable, you may want to declare your RadWindow on the page and get the position right etc when it opens. It doesn't affect me too much as I had a workaround and it was only in one place. All my other RadWindows are instantiated and managed by a manager class and they load in the requested content upon instantiation, so it's all dynamic.

Shame this though!
0
Kenneth
Top achievements
Rank 1
answered on 08 Sep 2011, 04:18 AM
I have about 20 very complex radwindows in XAML that are breaking due to this improvement!

Not sure I understand the solution. Do I have to put each of those in their own separate user control?

-Ken
0
Trude
Top achievements
Rank 2
answered on 08 Sep 2011, 09:23 AM
Yes, either create user controls which inherits RadWindow or create your windows from code behind. I have a "window manager" class that handles all my windows (create, open, close, handling events and messages between them etc.) - the class also keeps track of memory usage/leaks as it has weak references to the window itself and it's contents.
0
Trude
Top achievements
Rank 2
answered on 08 Sep 2011, 09:29 AM
This breaking change will mean some work for a lot of people, but in the end I think it's worth it. The performance of the RadWindow has increased a lot in certain scenarios (especially treeview, gridview and tileview in my case)
Tags
Window
Asked by
Charles
Top achievements
Rank 1
Answers by
Charles
Top achievements
Rank 1
Brad
Top achievements
Rank 2
Kenneth
Top achievements
Rank 1
Trude
Top achievements
Rank 2
Share this question
or