How do I pass the same namespace in a XAML file?
This question is related to WPF Application.
I have a class as shown below in Project " Common ". The namespace name is also the same.
namespace Common
{
public ViewBase : UserControl
{
// Code
}
}
If I add a new abc.XAML file to the same project ( Common ) ... I would like to get my code by class (abc.xaml.cs file) from the ViewBase class.
But in this case, how do I write my title in the XAML file?
That is ... how should I reference my current namespace?
<Namespace:ViewBase x:Class=""
xmlns:x=""
....>
+3
source to share
1 answer
You can declare a namespace using xmlns
mapping , it is also active on the current element, so the namespace can be used in the tag the element that declares it. eg.
<ns:ViewBase xmlns:ns="clr-namespace:Common" ...>
+5
source to share