using System.Windows.Controls; using TeamAAS_VP.ViewModels.Product; namespace TeamAAS_VP.Views.Product { /// /// Interaction logic for TestProductPage /// public partial class TestProductPage : UserControl { TestProductPageViewModel VM; public TestProductPage() { InitializeComponent(); this.display.HorizontalScrollBar = false; this.display.VerticalScrollBar = false; this.display.AutoFit = true; this.display.BackColor = System.Drawing.SystemColors.ActiveCaption; this.display1.HorizontalScrollBar = false; this.display1.VerticalScrollBar = false; this.display1.AutoFit = true; this.display1.BackColor = System.Drawing.SystemColors.ActiveCaption; VM = DataContext as TestProductPageViewModel; VM.PropertyChanged += VM_PropertyChanged; } private void VM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { try { if (e.PropertyName == "Image") { this.display.Image = VM.Image; } else if (e.PropertyName == "Graphic") { this.display.StaticGraphics.Clear(); if (VM.Graphic != null) { this.display.StaticGraphics.AddList(VM.Graphic, ""); } } else if (e.PropertyName == "Image1") { this.display1.Image = VM.Image; } else if (e.PropertyName == "Graphic1") { this.display1.StaticGraphics.Clear(); if (VM.Graphic != null) { this.display1.StaticGraphics.AddList(VM.Graphic, ""); } } } catch (System.Exception) { } } } }