Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more: , +
Hi,

Can anybody help me to suggest how to Load Xaml file in a Container (eg: Canvas or please suggest any other suitable container) in a xaml page in WPF.

Solution along with code is highly appreciated.



Thanks in advance.
Posted
Updated 11-May-13 1:23am
v2
Comments
Mohammed Hameed 11-May-13 6:22am    
Any quick solutions highly appreciated.
Sergey Alexandrovich Kryukov 11-May-13 23:22pm    
Id depends on what's in that XAML file. I never had problem with putting the appropriate XAML content in a canvas. What did you try and what's the problem?
—SA
Mohammed Hameed 13-May-13 1:25am    
Thanks for your comment. The XAML contains the default xaml page content in WPF. I have to load this in a canvas but provided I should be able to implement drag/drop feature in future. So, can a Canvas supports drag/drop? Also, can u plz send a sample of loading xaml in canvas?
Thanks.
Sergey Alexandrovich Kryukov 13-May-13 1:30am    
I don't think a page can be a child of Canvas. You need to use XAML vector graphics object, which can be another Canvas.
—SA
Mohammed Hameed 13-May-13 1:38am    
Thanks. Can you plz send a sample.

1 solution

I'm not sure you can make a page a child of Canvas, but it surely could be another Canvas instance. You can read a Canvas object from the XAML file and insert the result of it.

For a sample of appropriate XAML, you can use use open-source Inkscape (wonderful application, a must to have, especially for a developer), draw something and export drawing as XAML:
http://en.wikipedia.org/wiki/Inkscape[^],
http://www.inkscape.org/[^].

Perhaps you need to manually remove unwanted Name attributes. As far as I remember, I had to do some manual cleanup of the Inkscape export, but it can easily be automated.

—SA
 
Share this answer
 
v2
Comments
Mohammed Hameed 13-May-13 2:26am    
Thanks a lot for the answer...
Sergey Alexandrovich Kryukov 13-May-13 2:29am    
My pleasure.
—SA
Mohammed Hameed 13-May-13 2:34am    
I have one more query plz, recently I have posted a Tip/Trick article but it is showing status as closed now. Reviewers (admins) have given a feedback as quality is poor. How can I get the detailed feedback information so that I will consider those things for my future posts as this was my first article..
Sergey Alexandrovich Kryukov 13-May-13 2:36am    
You have to write to admins...
—SA
Mohammed Hameed 13-May-13 2:41am    
From where I can write to admins, plz provide the menu options.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900