using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using ProjetTheAlone.Classes; using ProjetTheAlone.Model; using ProjetTheAlone.ViewModel; namespace ProjetTheAlone.UserControlDIY { /// /// Interaction logic for Repa.xaml /// public partial class Repa : UserControl { public RepaModel RM { get { return this.DataContext as RepaModel; } } public C_T_plat Plat1 { get => ((RM==null)?new C_T_plat():RM.Plat1 ?? new C_T_plat()); } public C_T_plat Plat2 { get => ((RM == null) ? new C_T_plat() : RM.Plat2 ?? new C_T_plat()); } public C_T_plat Plat3 { get => ((RM == null) ? new C_T_plat() : RM.Plat3 ?? new C_T_plat()); } public Repa() { InitializeComponent(); GridPrinc.DataContext = RM; Plat1XML.DataContext = Plat1; this.DataContextChanged += new DependencyPropertyChangedEventHandler(updateDataContext); } public void updateDataContext(object o, DependencyPropertyChangedEventArgs e) { GridPrinc.DataContext = RM; Plat1XML.DataContext = Plat1; Plat2XML.DataContext = Plat2; Plat3XML.DataContext = Plat3; } } }