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

Wrong Selected Window when Loading from Xml

4 Answers 90 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Marien Monnier
Top achievements
Rank 1
Marien Monnier asked on 17 Jul 2009, 12:20 PM
Hi the Telerik Team,

There is a error with the RadDock when loading layout from XML file.
When you load the layout from an XML file, the selected index of a DocumentContainer or a ToolTabStrip is incorrect. The last one is always selected, even if the SelectedIndex is the first.
You can easily reproduce this bug with the demo application on Dock / Serialization:
- Add a tool window to the same area as Tool Window 2
- Select the first window of the ToolTabStrip (Tool Window 4)
- Save the layout
- If you open the layout file in an editor, you can see that the ToolTabStrip's SelectedIndex is 0 (correct).
- Remove all windows
- Load the layout file
- The Tool Window 2 is selected instead of the Tool Window 4.

Thank you,

Regards

4 Answers, 1 is accepted

Sort by
0
Marien Monnier
Top achievements
Rank 1
answered on 17 Jul 2009, 12:44 PM
In the mean time, if someone encounter this problem, and while it's not fixed, I made this solution:

// Load the configuration file
radDock1.LoadFromXml(this.layoutConfigFile);

// Load the file in an xmldocument
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(this.layoutConfigFile);

// We select all the ToolTabStrip and DocumentTabStrip nodes
XmlNodeList toolNodes = xmlDoc.SelectNodes("//Telerik.WinControls.UI.Docking.ToolTabStrip | //Telerik.WinControls.UI.Docking.DocumentTabStrip");
foreach (XmlNode toolNode in toolNodes)
{

  // The name of the TabStripPanel and the selected index
  string panelName = toolNode.Attributes["Name"].Value;
  int selectedIndex = int.Parse(toolNode.Attributes["SelectedIndex"].Value);

  // Retrieve this field. TODO : replace MainForm by your form name
  FieldInfo fieldInfo = typeof(MainForm).GetField(panelName, BindingFlags.Instance | BindingFlags.NonPublic);
  // Set the correct value for the selected index
  ((Telerik.WinControls.UI.TabStripPanel)fieldInfo.GetValue(this)).SelectedIndex = selectedIndex;
}



0
Jordan
Telerik team
answered on 22 Jul 2009, 03:57 PM
Hello Marien Monnier,

Thank you for writing.
We have already fixed this issue.
The fix will be available in the Q2 2009 SP1 release (due at the end of this month).

Best wishes,
Jordan
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
Abhishek
Top achievements
Rank 1
answered on 26 Apr 2011, 12:10 PM
Hi Team,

We're facing the same issue in the "Q1 - 2011" version of RadControls for Winforms.

The same can be easily reproduced in the sample demo provided as well.

Please provide us a solution to this as it is critical to our application.

Thanks
Abhishek Dudeja
0
Stefan
Telerik team
answered on 29 Apr 2011, 10:09 AM
Hi Abhishek,

Thank you for writing.

I am writing to confirm that this issue appears in the latest version of RadControls for WinForms. I have added this into our PITS system, where you can add your vote for it or subscribe for its status updates

Meanwhile, you can overcome this behavior, by using the code that Marien Monnier have provided earlier.

Your Telerik points have been updates for this report.

Should you have any other questions, do not hesitate to contact us.

Greetings,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Dock
Asked by
Marien Monnier
Top achievements
Rank 1
Answers by
Marien Monnier
Top achievements
Rank 1
Jordan
Telerik team
Abhishek
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or