Reputation: 23
If I write controls in different namespaces, I can't show the namespaces in XAML. Example:
Namespace Sample -> Class A
Namespace Sample.Controls -> Class B
We can write in XAML:
...
xmlns:sample="clr-namespace:Sample"
xmlns:controls="clr-namespace:Sample.Controls"
...
<sample:A .../>
<controls:B .../>
But this not:
<sample:Controls.B /> <-- Is not correct! ERROR!
But, when we use expresion blend SDK libraries, yes. They can. They have namespaces and are correct. We can use:
<i:Interaction.Behaviors />
<i:Interaction.Triggers />
<i:DependencyObjectHelper.SelfAndAncestors />
...
Write 'i:' and the intelisense show organization in namespaces...
How we can write libraries that do this?
Upvotes: 0
Views: 81
Reputation: 1235
After declaring your name space you have to make an instance of a class from that name space . so use Windows.ressources.
Floww this Link http://www.wpf-tutorial.com/wpf-application/resources/
Upvotes: 1
Reputation: 23
With the ILSpy i found the answer.
In 'i:interaction' the intellisense show an icon of namespace, but is not a real namespace, is an attached property. Interaction is a static class, and Behaviors and Triggers are attached properties.
Then, when we write:
<TextBox>
<i:Interaction.Behaviors> // Is a Attached Property, not an object
...
</i:Interaction.Behaviors>
</TextBox>
I thought that the syntax for properties and attached properties was the same, but no... is , not
<TextBox>
<TextBox.Width> // "normal" object property: <object+property>
...
</TextBox.Width>
<i:Interaction.Triggers> // attached property: <attachedProperty>
...
</i:Interaction.Triggers>
</TextBox>
Is correct?!?
Upvotes: 0