blob: 994a62657a35a080e6d3aec84716f38c3c1a025b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
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
{
/// <summary>
/// Represents an extended view user control useful MVVM pattern.
/// </summary>
/// <seealso cref="System.Windows.Controls.UserControl" />
/// <seealso cref="Tango.SharedUI.IView" />
public class View : UserControl, IView
{
/// <summary>
/// Occurs when the view is loaded and view model is defined as data context.
/// </summary>
public event EventHandler<IView> ViewAttached;
/// <summary>
/// Gets or sets a static instance of this view.
/// </summary>
public static IView Self { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="View"/> class.
/// </summary>
public View()
{
Self = this;
Loaded += View_Loaded;
}
/// <summary>
/// Handles the Loaded event of the View control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
private void View_Loaded(object sender, RoutedEventArgs e)
{
ViewAttached?.Invoke(this, this);
}
}
}
|