using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; namespace Tango.SharedUI.Controls { /// /// Represents an extended view user control useful MVVM pattern. /// /// /// public class View : UserControl, IView { /// /// Occurs when the view is loaded and view model is defined as data context. /// public event EventHandler ViewAttached; /// /// Gets or sets a static instance of this view. /// public static IView Self { get; set; } /// /// Initializes a new instance of the class. /// public View() { Self = this; Loaded += View_Loaded; } /// /// Handles the Loaded event of the View control. /// /// The source of the event. /// The instance containing the event data. private void View_Loaded(object sender, RoutedEventArgs e) { ViewAttached?.Invoke(this, this); } } }