public SerialPortChat() { InitializeComponent(); if (this.DataContext != null) { ViewModel = (SerialPortChatViewModel)this.DataContext; } }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { ViewModel = (SerialPortChatViewModel)this.DataContext; }