Vla*_*kov 5 c# 64-bit xaml design-time visual-studio-2015
我目前正在运行Visual Studio 2015的"14.0.23103.0 D14REL",并注意到关于实现ICommandSource接口的自定义UI控件的一个奇怪的设计时异常.更有趣的是,如果目标平台是x64,问题就出现了.当设置来自上述接口的实现的自定义控件的Command属性时,VS设计器抛出" 属性"命令"没有可访问的setter "异常.
当平台是x64或者我错过了某些东西时,这是Visual Studio 2015的已知问题吗?这是我实现的一些代码.
风景
<Grid>
<local:MyControl MySecondCommand="{Binding MyCommand}"
Command="{Binding MyCommand}"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)自定义控件
public class MyControl : Control, ICommandSource
{
public static readonly DependencyProperty MySecondCommandProperty =
DependencyProperty.Register("MySecondCommand", typeof(ICommand), typeof(MyControl), new PropertyMetadata(null));
public ICommand MySecondCommand
{
get { return (ICommand)this.GetValue(MySecondCommandProperty); }
set { this.SetValue(MySecondCommandProperty, value); }
}
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof(ICommand), typeof(MyControl), new PropertyMetadata(null));
public ICommand Command
{
get { return (ICommand)this.GetValue(CommandProperty); }
set { this.SetValue(CommandProperty, value); }
}
public object CommandParameter
{
get
{
throw new NotImplementedException();
}
}
public IInputElement CommandTarget
{
get
{
throw new NotImplementedException();
}
}
}
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
363 次 |
| 最近记录: |