How to call 开发者_运维知识库a method or use a variable from a different namespace in another class in another namespace in a xaml file?
You can add references to namespaces in your xaml root element like this...
<UserControl
x:Class="MySolution.MyNamespace.MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:another="clr-namespace:MySolution.AnotherNamespace">
You can then reference objects from within that namespace in your xaml, for example, I want to bind the Command property of my Button to a command in AnotherNamespace...
<Button Command="{x:Static another:MyCommand}"/>
I can't really offer much more help than that though without knowing what you actually hope to achieve.
精彩评论