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

RadDocking Exception when i pin and unpin a pane twice.

12 Answers 201 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Antonis
Top achievements
Rank 2
Antonis asked on 08 Jan 2009, 02:34 PM
Hi, 

I have a problem with the RadDocking control which lies inside a RadWindow. 

Say that you have 3 panes (one main pane, one left and a bottom one). I want to click something 
on the left pane and create a new object (let's say a TextBlock) and attach it to the grid which is 
in the bottom pane. 

Once we click on the Create button in the left pane, a new TextBlock is created in the grid in the 
bottom pane. We unpin the bottom pane, and we remove the TextBlock that was created (we wanted it 
to work that way). Once again we click on the Create button in the left pane and a new TextBlock 
is created in the grid in the bottom pane and the bottom pane is again in pin mode. If i unpin the
bottom pane again, i get the following exception 

Line: 453
Error: Sys.InvalidOperationException: Runtime error 2028 in control 'Xaml1', method: The name already exists in the tree: buttonPane.

(buttonPane is the bottom pane in my xaml code)

I will open a support ticket and attach the project created. 


Thanks, 

Antonis

12 Answers, 1 is accepted

Sort by
0
Antonis
Top achievements
Rank 2
answered on 08 Jan 2009, 02:37 PM
There isn't a RadDocking category on the Support Tickets list. 

Please create!


Many thanks,

Antonis
0
Valeri Hristov
Telerik team
answered on 08 Jan 2009, 02:47 PM
Hi Antonis,

To speed the things up while we are researching why the RadDocking product is missing from the support page, I would suggest opening a support ticket for any control for Silverlight and attaching the project there. We will get the project from there and change the associated product :)

Regards,
Valeri Hristov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Antonis
Top achievements
Rank 2
answered on 08 Jan 2009, 03:03 PM
Ok, just did. Placed it in the RadDockPanel.

Thanks,

Antonis
0
Srinivas
Top achievements
Rank 1
answered on 22 Jul 2009, 07:03 AM
Hello Valeri Hristov,

I am experiencing similar issue but the scenario is slightly different as explained below.

I have a xaml page with two DockPanels, one for header (top) and one for details (bottom). In the details dock panel I have a TextBlock control with x:Name="myText". I have two different menu options (RadTreeViewItem * 2) but for both menu options I am using the same xaml page (the first menu option requests "Open" Orders in the system and the second menu option requests "Closed" Orders in the system, so I am passing a parameter called Type and depending on the Type it requests different records) but creating two different instances using Reflection command (Assembly.GetExecutingAssembly().CreateInstance(URLPage)). These two instances are loaded in two different tabs (RadTabItem * 2) of RadTabControl, so far it is OK. Next, when I unpin the details pane of the first tab (first instance of the xaml page) then the details pane is hidden and so far there is no issue. But the problem comes when I try to unpin the details pane of the second tab (second instance of the xaml page) then I am getting below error message:

Error: Unhandled Error in Silverlight Application
Code: 2028
Category: RuntimeError
Message: The name already exists in the tree %0
Method Name: <empty>

Interestingly, I am getting second error message for the same case but the only difference is instead of using the unpin icon I selected "Auto Hide" option from the RadPanel Menu (dropdown menu). When this selection happens the entire page (or browser screen) turns empty (or white screen) and below error message also shown apart from the 2028 error message which I mentioned above, but this second error message is very lengthy and I am posting only few lines below.

Error: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException: Value does not fall within the expected range
at MS.Internal.Xcplmports.CheckHResult(UInt32 hr)
at MS.Internal.XCPImports.Collection_AddValue(T)
(PresentationFrameworkCollection`1 collection, CValue value)
at MS.InternalXcpImports.Collection_AddDependencyObject
value)
at
................
................
................
at Telerik.Windows.Controls.Docking.AutoHideArea.Add(RadPane pane)
at Telerik.Windows.Controls.Docking.AutoHideArea.UnpinPane (RadPane pane)
at Telerik.Windows.Controls.RadDocking.UnpinPane(RadPane radPane, AutoHideArea area, Boolean stopEvents)
at Telerik.Windows.Controls.RadDocking.RadPane_PinChange
(Object sender, PinChangeEventArgs args)
<end of error message>

When I remove x:Name="myText" of the TextBlock control of the details pane then everything work fine. I am not sure how to write xaml pages without using x:Name for the controls, especially if we want to manipulate these controls in the code-behind (C#).

Please advice.

(I am using RadControls for Silverlight Q2 2009)

Thanks
Srinivas






0
Kaloyan
Telerik team
answered on 23 Jul 2009, 11:47 AM
Hi Srinivas,

As i understood by examining the exception which you are getting, you are trying to add two elements with same names which is not allowed in the Silverlight. Try to separate them in a user control(as they are in a different NameScope) and then add them as a content of the RadDocking. If the above written is not answering your questions, could you provide us with a sample code showing the issue.

All the best,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Srinivas
Top achievements
Rank 1
answered on 23 Jul 2009, 06:11 PM
Hello Kaloyan,

This is the case where I am creating two different instances of the same page and loading them in two different tab items of a tabcontrol. My understanding is if I create two different instances of an object they don't conflict with each other in terms of fields or methods or data that these objects contain.

Below is the relevant code extracted from the project and please let me know if you need any further details. 

Thank you very much for your help
Srinivas

(1) BrowseOrdersPage.xaml
<UserControl x:Class="GApp.Contents.WO.BrowseOrdersPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:docking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
    >
    <Grid>
        <docking:RadSplitContainer Orientation="Vertical" InitialPosition="DockedBottom">
            <docking:RadPaneGroup>
                <docking:RadPane Header="Header" 
                             CanUserClose="False" 
                             CanFloat="False" 
                             CanUserPin="True" 
                             CanDockInDocumentHost="False">
                    <Button Content="Close Tab" Height="25" Width="150" Click="Cancel_Click" ></Button>
                </docking:RadPane>
            </docking:RadPaneGroup>
            <docking:RadPaneGroup>
                <docking:RadPane Header="Details" 
                             CanUserClose="False" 
                             CanFloat="False" 
                             CanUserPin="True"
                             CanDockInDocumentHost="False">
                    <TextBlock x:Name="PageParam" Text=""></TextBlock>
                </docking:RadPane>
            </docking:RadPaneGroup>
        </docking:RadSplitContainer>
    </Grid>
</UserControl>
*************************
*****Code-behind****
*************************
    public partial class BrowseOrdersPage : UserControl, IGPage
    {
        public String OrderStatus;
        Dictionary<String, String> PreFilters;
        
        public BrowseOrdersPage()
        {
            InitializeComponent();
            PreFilters = new Dictionary<string, string>();
            Loaded += new RoutedEventHandler(BrowseOrdersPage_Loaded);
        }

        void BrowseOrdersPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!App.TabLoaded(PreFilters["SourceName"]))
            {
                App.RegisterTab(PreFilters["SourceName"]);
                foreach (KeyValuePair<string, string> kvp in PreFilters)
                {
                    PageParam.Text += kvp.Key + "=" + kvp.Value + "\n";
                }
            }
         }

        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            App.tabs.Remove(this.ToString());
            ((MainPage)Application.Current.RootVisual).RemoveTabItem((RadTabItem)
                ((MainPage)Application.Current.RootVisual).AppTabGroup.SelectedItem);
        }

        //this method is needed to implement IGPage and to get parameters from the menu
//this method is invoked by MainPage.xaml.cs when the instance of this page is created
        public void SetPageParameters(Dictionary<String, String> parameters)
        {
            PreFilters = parameters;
        }
    }
============================
(2) MainPage.xaml 
(GTreeViewItem is derived from RadTreeViewItem and I have added additional properties)

<GControls:GTreeViewItem Header="Browse Open Orders" Name="BrowseOpenOrders"
 Selected="GTreeViewItem_Selected"
 XAPFileName=""
 PageName="GApp.Contents.WO.BrowseOrdersPage?Status=Open"/>
<GControls:GTreeViewItem Header="Browse Closed Orders" Name="BrowseClosedOrders"
 Selected="GTreeViewItem_Selected"
 XAPFileName=""
 PageName="GApp.Contents.WO.BrowseOrdersPage?Status=Close&amp;Type=MFG"/>

- as you can see both menu items are calling the same page but with different parameters
==============================
(3) MainPage.xaml.cs
As you can see below I am using Reflection to create instance of the requested page and my understanding is
that when I create two different instances of the same object they don't conflict with each other in terms of fields or methods
.....
(var pageInstance = Assembly.GetExecutingAssembly().CreateInstance(URLPage[0]);)
tabitem.content = pageInstance
.....
private void GTreeViewItem_Selected(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            selectedTreeItem = (GTreeViewItem)sender;
            selectedTreeItem.IsSelected = false;
//if the page instance is already loaded then use same instance
//loadedtabs is a dictionary (private Dictionary<String, RadTabItem> loadedtabs;)
            if (loadedtabs.ContainsKey(selectedTreeItem.Name))
            {
                AppTabGroup.SelectedItem = loadedtabs[selectedTreeItem.Name];
            }
            else
            {
                if (AppTabGroup.Items.Count == App.MaxAllowedTabs)
                {
                    MessageBox.Show("Maximum Tab limit reached");
                    return;
                }
                tabitem = new RadTabItem();
                tabitem.Header = selectedTreeItem.Header;
                tabitem.MinWidth = 125;
                tabitem.Name = selectedTreeItem.Name;

                if (selectedTreeItem.XAPFileName == "")
                {
                    String[] URLPage;
                    URLPage = selectedTreeItem.PageName.Split('?');
                    String[] URLParam = URLPage[1].Split('&');
                    Dictionary<String, String> PageParams = new Dictionary<string, string>();
                    foreach (String parm in URLParam)
                    {
                        String[] each = parm.Split('=');
                        PageParams[each[0].Trim()] = each[1].Trim();
                    }
                    PageParams["SourceName"] = tabitem.Name;
                    var pageInstance = Assembly.GetExecutingAssembly().CreateInstance(URLPage[0]);
                    Type pageInstanceType = pageInstance.GetType();
                    MethodInfo pageInstanceMethod = pageInstanceType.GetMethod("SetPageParameters");
                    object[] ObjParam = new object[1];
                    ObjParam[0] = PageParams;
                    pageInstanceMethod.Invoke(pageInstance, ObjParam);
                    tabitem.Content = pageInstance;
                    AppTabGroup.Items.Add(tabitem);
                    AppTabGroup.SelectedItem = tabitem;
                    loadedtabs[tabitem.Name] = tabitem;
                }
            }
        }
=============================



0
Srinivas
Top achievements
Rank 1
answered on 23 Jul 2009, 10:03 PM
Hi,

Also, I tried using two different xaml pages for two different tab items. These two xaml pages can load without any problem and I can work with two xaml pages by switching the tabs, please note that both xaml pages has a TextBlock with x:Name=PageParam. But when I try to unpin the dock panel of both pages and if both dock panels contain x:Name with same name then I get this error message.

I am not sure how the dock panel unpin (or Auto Hide) mechanism works internally, but from high level I can imagine the mechanism uses some kind of stacking mechanism to store each unpinned dock panels (like a container) and if that container finds duplicate x:Name then it is throwing this exception. I am not sure if the unpinned dock panels carry their parent object name with it to say that "I belong to this parent" to avoid duplication then probably we will not have this issue.

But it looks like all unpinned panels are losing their original parent reference or the container is not storing the unpinned panels's parent reference (for example, page1.xaml or page2.xaml) and all of them are going into a new parent (or container) something like AutoHidePanelStackContainer which holds all unpinned panels.

Interestingly, when I change the first xaml dockpanel initial position to DockedBottom and the second xaml dockpanel to DockedTop then when I unpin I am getting different error message 2210 AG_E_INVALID_ARGUMENT error but both dockpanels are unpinned (one at the top and another at the bottom) and both of them have the same x:Name TextBlock field.

Please let me know if there is any alternate way to attach the project.

Thanks
Srinivas

0
Nikolay
Telerik team
answered on 24 Jul 2009, 11:10 AM
Hello Srinivas,

Our forums do not allow attachments. You can send a General Feedback from your account and attach the project there.

Greetings,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Srinivas
Top achievements
Rank 1
answered on 24 Jul 2009, 10:09 PM
Hello Nick,

I have attached a RAR file with complete project and a word document explaining the problem. Please help me at the earliest possible as our framework design completely depends on solving this issue.

The ticket number that was assigned to my general feedback: Ticket ID is: 230144

Thanks
Srinivas
0
Nikolay
Telerik team
answered on 27 Jul 2009, 01:21 PM
Hi Srinivas,

We will handle your ticket.

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
kevin earley
Top achievements
Rank 1
answered on 11 Nov 2009, 07:20 PM
Any word on this issue?  I am having the same problem.

-Kevin
0
Miroslav Nedyalkov
Telerik team
answered on 16 Nov 2009, 11:48 AM
Hello Kevin,

Could you please open a support ticket and send us a sample project that reproduces the problem?

The problem described in this thread shouldn't appear any more.

Greetings,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Docking
Asked by
Antonis
Top achievements
Rank 2
Answers by
Antonis
Top achievements
Rank 2
Valeri Hristov
Telerik team
Srinivas
Top achievements
Rank 1
Kaloyan
Telerik team
Nikolay
Telerik team
kevin earley
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or