急,当编译平台为X64平台的时候,Xaml设计器上无法显示Viewmodel的值

cpycpy000 2020-05-12 04:07:49
当平台为AnyCPU和X86的时候都是正常的。

X64:


X86或AnyCPU:



<Window x:Class="CefTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CefTest"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.DataContext>
<local:TestM/>
</Window.DataContext>
<Grid>
<Button Click="Button_Click" Width="200" Height="100" Margin="141,90,451,229" Content="{Binding TextStr}"/>
<TextBox Width="200" Height="400" TextWrapping="Wrap" x:Name="textb1" Text="{Binding TextStr}"/>
<ContentControl x:Name="mainf">
</ContentControl>
<Button Click="Button_Click1" Width="200" Height="100" Margin="441,229,151,90" Content="{Binding TextStr}"/>
</Grid>
</Window>



public class TestM : INotifyPropertyChanged
{
private string _tes = "123123123123";

public TestM() { }

public string TextStr
{
get => _tes;
set
{
if (_tes != value)
{
_tes = value;
RaisePropertyChanged();
}
}
}


public event PropertyChangedEventHandler PropertyChanged;

protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
...全文
75 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,568

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧