How to use XAML namescope in Silverlight?

Answer

Namescope allows the templates in Silverlight to allow the reusability of the content and it can also include the elements with the names defined at the template level. The template can be reused for more than once in the same page. To be able to do that every single template defines their own XAML namescope that differentiate and make it independent from other templates and styles. Due to the difference in the namescope finding the elements within the template from a page is easy. GetTemplateChild method is used to get the template element from the template used in various pages or in a single page. The following code is used to set the same template on two different controls :
<UserControl
xmlns="http://xyz.com/xaml/presentation"
xmlns:x="http://xyz.com/xaml" >
<UserControl.Resources>
<ControlTemplate x:Key="Temp">
//write your own code here
<TextBlock x:Name="TextBlock" />
</ControlTemplate>
</UserControl.Resources>
</UserControl>

All silverlight Questions

Ask your interview questions on silverlight

Write Your comment or Questions if you want the answers on silverlight from silverlight Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---