Wpf Can';t将类作为参数传递给命令

Wpf Can';t将类作为参数传递给命令,wpf,Wpf,我是编程新手,很难将我在中创建的类作为命令中的参数传递给XAML <Window.Resources> <local:RegisterWindowViewModel x:Key="RegViewModel"/> <local:RegisterValidationConverter x:Key="RegValid"/> <local:UsersViewModel x:Key="UVM"/> </Win

我是编程新手,很难将我在
中创建的类作为命令中的参数传递给
XAML

  <Window.Resources>
      <local:RegisterWindowViewModel x:Key="RegViewModel"/>
      <local:RegisterValidationConverter x:Key="RegValid"/>
      <local:UsersViewModel x:Key="UVM"/>
  </Window.Resources>

这是带有命令绑定的按钮

    <Button Name="signupButton" DataContext="{StaticResource UVM}"
            Height="50" Width="150" BorderBrush="Black" BorderThickness="2" 
            FontSize="20" FontWeight="SemiBold"
            Style="{StaticResource AccentedSquareButtonStyle}"
            Command="{Binding GetRegisterItemCommand}"
            CommandParameter="{Binding RegViewModel}">
        Sign Up
    </Button>

注册
我认为这段代码
CommandParameter=“{Binding RegViewModel}”
不正确,但我不知道如何替换它

因此,我在命令函数中得到了一个
null
,而不是我的对象。 功能本身是正常的;我已经对它进行了很多测试,例如,我尝试传递另一个对象(
TextBox
),它工作得很好

我只是不懂语法

甚至可以传递在资源中创建的类吗


我将非常感谢您的帮助。

您尝试的方式表明,它可以在当前的
DataContext
上找到
RegViewModel

要指向viewmodel本身,您可以说绑定的源是您的
RegViewmodel
,并进行以下更改。在这种情况下,完整的
RegViewModel
将传递给
CommandParameter

CommandParameter="{Binding Source={StaticResource RegViewModel}}"