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

Prism with Dock issue

7 Answers 121 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Eric Belanger
Top achievements
Rank 1
Eric Belanger asked on 06 May 2010, 08:21 PM
I am using RadDocking along with Prism.  I found the sample provided by Telerik on the subject and i am using it as well.

My problem is that i want to destroy the Region when a RadPane is closed.  Which is something the sample is not doing.

So, it brings us to this:

protected override void Adapt(IRegion region, RadPaneGroup regionTarget) 

At this stage, i would like to be able to get a reference to the RadDocking, to subscribe the Close event, and then do the destroy Region stuff.

But i can't figure out how to get the RadDocking from a RadPaneGroup.  I tried several FindParent function, but none seems to be able to travel up the VisualTree to the RadDocking.

I am using the latest internal build.

Thank you for any help.

7 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 11 May 2010, 11:12 AM
Hi Eric,

 You could try the ParentOfType extension method. It is a generic method with no parameters. The type parameter is the type to look for up in the visual tree. You could do the following: regionTarget.ParentOfType<RadDocking>().

Hope this helps!

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.
0
Eric Belanger
Top achievements
Rank 1
answered on 11 May 2010, 03:50 PM
Thank you,

I eventually did that.  But i had problems doing so because at this stage, it returned null.  I had to subscribe to the loaded event, and do the find parent there instead.
0
Miroslav Nedyalkov
Telerik team
answered on 13 May 2010, 12:48 PM
Hi Eric,

 Were you able to fix the problem subscribing to the Loaded event and going up the visual tree while you find the Docking control?

Sincerely yours,
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.
0
Eric Belanger
Top achievements
Rank 1
answered on 13 May 2010, 03:55 PM
Yes, but it's really awkward.  I have to keep my region somewhere, since i have to reference it in the loaded event later.  I checked in source code and the RadPane do have a variable pointing to the RadDocking, and it is affected in the internal loaded event.  That is what hinted me to use the Loaded event.  But this variable is not a public property.

But there should be a cleaner way to do that.  The RadPane should be able to return me the RadDocking before any loaded event.  But i fear this restriction is be design.
0
Miroslav Nedyalkov
Telerik team
answered on 13 May 2010, 05:51 PM
Hi Eric,

 We are unable to find the Docking control before the loaded event, because the pane itself doesn't belong to the Docking control. Once the loaded event happens, the pane is placed in the visual tree and is associated with a Docking control. Not cleaner, but approach could be to use lambda instead of a method for event handler. This way you will have access to all local variables including the parameters in the scope of the lambda.

Kind regards,
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.
0
Eric Belanger
Top achievements
Rank 1
answered on 13 May 2010, 05:53 PM
Yes that is what i have done actually.
0
Wagner
Top achievements
Rank 1
answered on 05 Jul 2010, 04:23 PM
Eric,

I have the same issue.  Can you share your updated Region Adapter code?

Thanks in advance,

Wagner
Tags
Docking
Asked by
Eric Belanger
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Eric Belanger
Top achievements
Rank 1
Wagner
Top achievements
Rank 1
Share this question
or