我正在尝试使用 ObjectDataProvider 调用 Mouse 的 GetPositition 方法,但出现此错误:
System.Windows.Data 错误:34:ObjectDataProvider:尝试调用类型方法失败;方法='获取位置'; 类型='鼠标'; 错误='未找到具有匹配参数签名的方法。' MissingMethodException:'System.MissingMethodException:找不到方法'System.Windows.Input.Mouse.GetPosition'。
这是我目前的代码:
<ObjectDataProvider MethodName="GetPosition" ObjectType="{x:Type sys:Mouse}" x:Key="odp">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:TestType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
使用简单的绑定:
{绑定源={StaticResource odp}}
为什么无论我做什么都报告找不到方法?