-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
FocusEffect.cs
37 lines (35 loc) · 1.03 KB
/
FocusEffect.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
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI;
using Microsoft.Maui.Controls.Compatibility.Platform.UWP;
using Microsoft.Maui.Controls.Platform;
using Microsoft.UI;
using Microsoft.UI.Xaml.Media;
using Windows.UI;
[assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")]
namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI
{
public class FocusEffect : PlatformEffect
{
protected override void OnAttached()
{
try
{
(Control as Microsoft.UI.Xaml.Controls.Control).Background = new Microsoft.UI.Xaml.Media.SolidColorBrush(Colors.Cyan);
(Control as FormsTextBox).BackgroundFocusBrush = new Microsoft.UI.Xaml.Media.SolidColorBrush(Colors.White);
}
catch (Exception ex)
{
Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
}
}
protected override void OnDetached()
{
}
}
}