Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Grabacr07
Created August 28, 2015 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grabacr07/99a05f0c4c9631bbbb89 to your computer and use it in GitHub Desktop.
Save Grabacr07/99a05f0c4c9631bbbb89 to your computer and use it in GitHub Desktop.
.NET Framework 4.5 だと動く。4.5.1 だと例外スローされる。
<Window x:Class="WpfApplication38.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="200"
Height="100">
<TextBox Text="{Binding SampleText}" />
</Window>
using System.ComponentModel;
namespace WpfApplication38
{
partial class MainWindow
{
public MainWindow()
{
this.InitializeComponent();
this.DataContext = new ViewModel();
}
}
public class ViewModel : INotifyPropertyChanged
{
public string SampleText { get; private set; } = "なぜか動く";
public event PropertyChangedEventHandler PropertyChanged;
}
}
@Grabacr07
Copy link
Author

ViewModel が INotifyPropertyChanged を実装していない場合、.NET Frameowrk 4.5 でも動かなくなる。っぽい。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment