-
-
Notifications
You must be signed in to change notification settings - Fork 492
/
Copy pathMenuFlyoutContent.cs
63 lines (51 loc) · 1.79 KB
/
MenuFlyoutContent.cs
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// Copyright Fela Ameghino 2015-2025
//
// Distributed under the GNU General Public License v3.0. (See accompanying
// file LICENSE or copy at https://www.gnu.org/licenses/gpl-3.0.txt)
//
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Telegram.Controls
{
public partial class MenuFlyoutContent : MenuFlyoutItem
{
public MenuFlyoutContent()
{
DefaultStyleKey = typeof(MenuFlyoutContent);
}
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (Content is Control control && FocusState != FocusState.Unfocused)
{
control.Focus(FocusState);
}
}
protected override void OnGotFocus(RoutedEventArgs e)
{
if (Content is Control control && FocusState != FocusState.Unfocused)
{
control.Focus(FocusState);
}
}
#region Content
public object Content
{
get { return (object)GetValue(ContentProperty); }
set { SetValue(ContentProperty, value); }
}
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register("Content", typeof(object), typeof(MenuFlyoutContent), new PropertyMetadata(null));
#endregion
#region ContentTemplate
public DataTemplate ContentTemplate
{
get { return (DataTemplate)GetValue(ContentTemplateProperty); }
set { SetValue(ContentTemplateProperty, value); }
}
public static readonly DependencyProperty ContentTemplateProperty =
DependencyProperty.Register("ContentTemplate", typeof(DataTemplate), typeof(MenuFlyoutContent), new PropertyMetadata(null));
#endregion
}
}