[UWP] FormsTextBox clean up OnApplyTemplate (#11285)

* Add Packager.Load back to Loaded Event

* - try size changed

* Clean Up

* FormsTextBox Cleanup

* Simplify Reference

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
This commit is contained in:
Brian Macomber 2020-07-28 12:56:55 -05:00 коммит произвёл GitHub
Родитель 4b582d4d47
Коммит 4682bef762
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 3 добавлений и 11 удалений

Просмотреть файл

@ -47,8 +47,7 @@ namespace Xamarin.Forms.Platform.UWP
InputScope _passwordInputScope; InputScope _passwordInputScope;
InputScope _numericPasswordInputScope; InputScope _numericPasswordInputScope;
Border _borderElement; ScrollViewer _scrollViewer;
Windows.UI.Xaml.Controls.ScrollViewer _scrollViewer;
Windows.UI.Xaml.Controls.Grid _rootGrid; Windows.UI.Xaml.Controls.Grid _rootGrid;
Windows.UI.Xaml.VisualState _DeleteButtonVisibleState; Windows.UI.Xaml.VisualState _DeleteButtonVisibleState;
Windows.UI.Xaml.VisualStateGroup _DeleteButtonVisibleStateGroups; Windows.UI.Xaml.VisualStateGroup _DeleteButtonVisibleStateGroups;
@ -157,14 +156,7 @@ namespace Xamarin.Forms.Platform.UWP
{ {
base.OnApplyTemplate(); base.OnApplyTemplate();
if (Device.Idiom == TargetIdiom.Phone) _rootGrid = GetTemplateChild("RootGrid") as Windows.UI.Xaml.Controls.Grid;
{
// If we're on the phone, we need to grab this from the template
// so we can manually handle its background when focused
_borderElement = (Border)GetTemplateChild("BorderElement");
}
_rootGrid = (Windows.UI.Xaml.Controls.Grid)GetTemplateChild("RootGrid");
if (_rootGrid != null) if (_rootGrid != null)
{ {
var stateGroups = WVisualStateManager.GetVisualStateGroups(_rootGrid).ToList(); var stateGroups = WVisualStateManager.GetVisualStateGroups(_rootGrid).ToList();
@ -173,7 +165,7 @@ namespace Xamarin.Forms.Platform.UWP
_DeleteButtonVisibleState = _DeleteButtonVisibleStateGroups.States.SingleOrDefault(s => s.Name == "ButtonVisible"); _DeleteButtonVisibleState = _DeleteButtonVisibleStateGroups.States.SingleOrDefault(s => s.Name == "ButtonVisible");
} }
_scrollViewer= (Windows.UI.Xaml.Controls.ScrollViewer)GetTemplateChild("ContentElement"); _scrollViewer= GetTemplateChild("ContentElement") as ScrollViewer;
} }
void OnSizeChanged(object sender, SizeChangedEventArgs e) void OnSizeChanged(object sender, SizeChangedEventArgs e)