Wpf 如何在xaml文件的另一个命名空间中的另一个类中调用方法或使用另一个命名空间中的变量?
如何在xaml文件的另一个命名空间中的另一个类中调用方法或使用另一个命名空间中的变量?您可以像这样在xaml根元素中添加对命名空间的引用Wpf 如何在xaml文件的另一个命名空间中的另一个类中调用方法或使用另一个命名空间中的变量?,wpf,xaml,Wpf,Xaml,如何在xaml文件的另一个命名空间中的另一个类中调用方法或使用另一个命名空间中的变量?您可以像这样在xaml根元素中添加对命名空间的引用 <UserControl x:Class="MySolution.MyNamespace.MyControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/
<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">
然后可以在xaml中引用该名称空间中的对象,例如,我想将我按钮的Command属性绑定到另一个名称空间中的命令
<Button Command="{x:Static another:MyCommand}"/>
在不知道您真正希望实现什么的情况下,我真的无法提供比这更多的帮助。请添加示例代码,解释您希望发生的情况和您得到的错误。