Home > other >  Nasty, Xaml designer cannot show on the value of the Viewmodel
Nasty, Xaml designer cannot show on the value of the Viewmodel

Time:09-20

I don't know what change is to set, reset is useless
Even if I set the value of Datacontext in Xaml directly, the Xaml binding also show only the attribute name, does not show the ViewModel set the default values,
Headache is dead, is long time on the computers of the company found this problem, the home also is ok, the result these days home become such,
D: dataContext is invalid,



 
Public class TestM: INotifyPropertyChanged
{
Private string _tes="123123123123";

Public TestM () {}

Public string TextStr
{
The get=& gt; _tes;
Set
{
If (_tes!=value)
{
_tes=value;
RaisePropertyChanged ();
}
}
}


The public event PropertyChangedEventHandler PropertyChanged;

Protected void RaisePropertyChanged ([CallerMemberName] string propertyName=null)
{
PropertyChanged? Invoke (this, new PropertyChangedEventArgs (propertyName));
}
}


 
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" & gt;






CodePudding user response:

Compared to the previous project, suddenly found that the reason of the first layer:

When compiling platform for X64 Xaml designer cannot obtain the ViewModel value within the
In AnyCPU are normal and X86,

So the question again, X64 is what circumstance? Is there a solution?

CodePudding user response:

The TestM in "& lt; Local: TestM/& gt;" Is a name of the Class.
I think the DataContext should be set to an instance.

CodePudding user response:

RaisePropertyChanged (" TextStr ");