【发布时间】:2016-06-06 02:38:11
【问题描述】:
我有一个在窗口 xaml 文件中创建的类,并且在我想将此窗口的某些属性(我的情况是 DialogResult 属性)绑定到我创建的类的属性之后。
<Window x:Class="Galery.RegistrationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:Galery"
Name="Reg"
local:DialogCloser.DialogResult="{Binding Source={StaticResource UVM}, Path=DialogResult}"
Title="Image Gallery 1.0 - Registration"
Height="700" Width="400" WindowStartupLocation="CenterOwner">
<Window.Resources>
<local:RegisterWindowViewModel x:Key="RegViewModel"/>
<local:RegisterValidationConverter x:Key="RegValid"/>
<local:UsersViewModel x:Key="UVM"/>
<local:ParameterConverter x:Key="paramConverter"/>
</Window.Resources>
在第 8 行出现错误 local:DialogCloser.DialogResult="{Binding Source={StaticResource UVM}, Path=DialogResult}"
我认为这是因为我正在使用的类尚未创建。
在 Window.Resources 中创建类后,如何将绑定添加到我的窗口,ro 甚至可以通过这种方式吗?
我希望我的解释清楚, 将非常感谢您的帮助。
【问题讨论】:
标签: wpf