110,568
社区成员
发帖
与我相关
我的任务
分享
<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));
}
}