i have a docking control that cause to error in run time.
when remove the line 5, and 11. the application run fine.
but i saw some bad things on ui(like spliter that not placed fine), i dont know if its due to my changes.
this is my code:
<Grid> | |
<radDock:RadDocking x:Name="radDocking1"> | |
<radDock:RadDocking.DocumentHostContent> | |
<radDock:RadSplitContainer> | |
<radDock:RadPaneGroup> | |
<radDock:RadDocumentPane Title="Description" Content="Some content" /> | |
</radDock:RadPaneGroup> | |
</radDock:RadSplitContainer> | |
</radDock:RadDocking.DocumentHostContent> | |
<radDock:RadDocking.SplitContainers> | |
<radDock:RadSplitContainer Width="150" MaxWidth="600" Name="LeftContainer" InitialPosition="DockedLeft"> | |
<radDock:RadPaneGroup x:Name="Group1"> | |
<radDock:RadPane x:Name="Pane2" Header="Toolbox"> | |
<Button Width="100" Height="40" Content="ghgfhfghfgh" Background="Blue"></Button> | |
</radDock:RadPane> | |
</radDock:RadPaneGroup> | |
</radDock:RadSplitContainer> | |
<radDock:RadSplitContainer Width="200" MaxWidth="679" x:Name="RightContainer" InitialPosition="DockedRight"> | |
<radDock:RadPaneGroup x:Name="Group2"> | |
<radDock:RadPane x:Name="Pane4" Header="Properties"> | |
<Button Width="100" Height="40" Content="ghgfhfghfgh"></Button> | |
</radDock:RadPane> | |
</radDock:RadPaneGroup> | |
</radDock:RadSplitContainer> | |
</radDock:RadDocking.SplitContainers> | |
</radDock:RadDocking> | |
</Grid> |
17 Answers, 1 is accepted
All the best,
Miroslav Nedyalkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I am creating RadPane on run time (ie on a button click)
This is what I do.
pane.Content = grid;
paneGroup.AddItem(pane, (DockPosition)2);
splitContainer.Items.Add(paneGroup);
mainDocking.Children.Add(splitContainer);
(grid is having a graph.)
On first time, on button click, it all works fine.
My requirement is that, on button click,if this Pane already exists, remove this pane and recreate every things again.
This is how I remove.
private
void RemovePane(RadPane Pane)
{
if (PaneExists(Pane.Name))
{
RadPaneGroup rpg = new RadPaneGroup ();
RadSplitContainer rsc = new RadSplitContainer();
rpg = Pane.ParentOfType<
RadPaneGroup>();
rsc = rpg.ParentOfType<
RadSplitContainer>();
Pane.RemoveFromParent();
rpg.RemoveFromParent();
mainDocking.Children.Remove(rpg);
}
}
I think, the code for Pane exists is irrilivant here, but this is how I do
private
bool PaneExists(string paneName)
{
bool recordFound = false;
IEnumerable<RadPane> existingPanes = mainDocking.Panes;
foreach (RadPane record in existingPanes)
{
if (record.Name == paneName)
{
recordFound =
true;
closingPane = record;
break;
}
}
return recordFound;
}
After RemovePane is done, I need to create Pane again so the same piece of code as above is called again.
pane.Content = grid;
paneGroup.AddItem(pane, (DockPosition)2);
splitContainer.Items.Add(paneGroup);
mainDocking.Children.Add(splitContainer);
At last line, it gives me "ArgumentException". Error message further says : Sys.InvalidOperationException: ManagedRuntimeError error#4004 in conrtol 'Xaml1': System.argumentException: Value doesnot fall within the expected range.
Any idea what is wrong here.
Thanks & Regards,
Vikash Sinha
ADP Inc.
Regards,
Miroslav Nedyalkov
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Thanks for the Demo Project but it is still not working for me.
In your example, go on and add 4 panes by clicking on the add panes button 4 times.
Try getting the value of RadDocking.Panes. It has 5 Pane (one of ur design time and 4 we added at runtime)
Now, close 2 panes created by runtime either by clicking X icon or the button you have placed on these panes.
Try getting the value of RadDocking.Panes. It still has 5 Pane.
Why?
I was expecting 3 Panes since I removed 2 from the parent.
Because of this, RadDocking.SaveLayout creates extra node into XML it generates and if you load your panes from this saved XML, it flickers.
Also, now with all the 5 panes on, make one of the Pane tabbed document. Now Count the RadDocking.Panes --- Now it is Only 4
and now if I do RadDocking.SaveLayout --- Tabbed Pane, even though I did not remove this, is not saved in the resultant XML String.
So, My question is :
1) When I am clicking X icon, that Pane should be gone from memory ie RadDocking.SaveLayout should not create a node for Pane I choosed to delete/remove.
How Do I achive this?
2) when I made a Pane tabbed document, I did not remove that from docking. So when I do RadDocking.SaveLayout, there should be a node for that so that I can reload that back.
How do I achieve this?
Appreciate your quick reply
Hello Vikash,
Regards,
Miroslav Nedyalkov
the Telerik team
If you hide a pane (either by clicking the X or by setting its Hidden property to true), the pane will stay in the Panes collection, but will be removed from the Items collection, which causes it to disappear.
If you unpin the pane, it will again stay in the Panes collection, but will be removed from the Items collection.
That means that you have 2 ways to get all the panes that are shown in the group:
Regards,
Miroslav Nedyalkov
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Thanks for your reply, but this still doesnot solve my problem.
I do RadDocking.SaveLayout and save the output of this into database.
with this, even my Hidden Panes are saved. Now when I do
RadDocking.LoadLayout, because of those hidden panes, it flickers .
This is not a big issue in dummy projects but in my case, I am putting Charts on the Panes and have to reload those charts when I do RadDocking.LoadLayout.
Hidden ones becomes visible for micro-minutes and Chart gets on them and then Panes gets hidden. If this behaviour occur 15 times while u r reloading the Panes, this flickers looks very very bad and since all the hidden panes are getting saved, this flicker will increase in future (ofcourse unless I delete the saved Records from Database, which is really not an option)
so, my question is, if on RadDocking.SaveLayout, I donot wish to save Hidden Panes, what do I need to do.
Thanks & regards,
Vikash Sinha
Regards,
Miroslav Nedyalkov
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
that breaks my heart. :)
I know how to delete Node from XML in C# but in Silverlight, its all togather a different ball game with LINQ and all. I donot wish to dive deep into LINQ at this moment.
Do you have any handy code which deletes nodes from XML in Silverlight
Thanks & Regards,
Vikash Sinha
Where is the code?
I guess you missed to paste that.
Thanks & Regards,
Vikash
Regards,
Miroslav Nedyalkov
What is special in this code?
You create 50 Panes and then do "RemoveFromParent" in foreach loop and then do a RadDocking.SaveLayout ---- You will get 50 entries(Node) for Rad Pane and that is the issue here. This does not solve my problem.
The fact that you are able to do
foreach
(RadPane pane in e.Panes)
{
pane.RemoveFromParent();
}
means that pane is not getting destroyed but just getting hidden or whatever otherwise ForEach would have crashed at runtime in second run.
My problem is that when I am doing RadDocking.SaveLayout, I donot want this invisible panes in my XML because if I load this XML, it causes pane to flicker.
Either you have not tested this before you posted or u r not getting my question. If it is the later case, please let me know and I will rewrite my question again.
Since u guys have the code, u must be knowing it better but thanks to all the problem I am facing because of this, I can give u a much better solution than this. (a Workaround) but I donot want to do that because that is another stupid bug of telerik.
but any way, to remove a hidden pane, u can do pane.menucommand[2].Notify(Pane)
for some reason, it deletes the Pane and if I do RadDocking.SaveLayout, it does not create this node in XML so this works fine for me but I feel this is obviously a bug and once you fix this bug, my system will not work so i can not rely on this bug as a feature.
If only I had known when I started this project that Docking component of telerik is so bugy.
Wonder why other developer has not faced this. May be they are wiser than me and looked for some other 3rd party components and not paid usd 1300 for a componenets that has nothing but bugs bugs and more bugs.
Amount of time I have spend in finding a workaround, I wonder, it would have been a better idea to write a docking component all by myself and not rely on some buggy 3rd Party so Called RAD tool.
Sorry to say my friend, but its not a Rapid Application Development tool. May be u guys have some other meaning of RAD
Severly disappoined by the product as well as support.
Kind Regards,
Vikash Sinha
Kind regards,
Miroslav Nedyalkov
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Is there a best practice for making sure the docking cleans up when the pane is closed/hidden?
The Docking control doesn't hold a collection with all the panes in order to enumerate them when you use the Panes property of the Docking control - it goes through all the split containers and finds all the panes that are in them recursively.
Actually when click the close button of a pane it is not closed, but hidden - it stays in the pane group that used to contain it. If you want to clean-up the hidden panes I would suggest you to remove them when they are hidden. In order to do that you could hook-up to the Close event of the Docking control and do your clean-up there.
Best wishes,Miroslav Nedyalkov
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.
The Close event of the RadDocking controls fires when you close a RadPane. In this case, you could call RadPane.RemoveFromParent() method in order to remove(close) the RadPane. Please, make sure you don't keep any references to this pane or to its content. Otherwise, it won't be disposed.
George
the Telerik team