Skip to content

Commit

Permalink
Cast for easy reading. (dotnet#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbritch authored Aug 24, 2022
1 parent dbcd34d commit 0404227
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public partial class CustomizeEntryPartialMethodsPage : ContentPage
{
partial void ChangedHandler(object sender, EventArgs e)
{
((sender as Entry).Handler.PlatformView as AppCompatEditText).SetSelectAllOnFocus(true);
Entry entry = sender as Entry;
(entry.Handler.PlatformView as AppCompatEditText).SetSelectAllOnFocus(true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public partial class CustomizeEntryPartialMethodsPage : ContentPage
{
partial void ChangedHandler(object sender, EventArgs e)
{
((sender as Entry).Handler.PlatformView as UITextField).EditingDidBegin += OnEditingDidBegin;
Entry entry = sender as Entry;
(entry.Handler.PlatformView as UITextField).EditingDidBegin += OnEditingDidBegin;
}

partial void ChangingHandler(object sender, HandlerChangingEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public partial class CustomizeEntryPartialMethodsPage : ContentPage
{
partial void ChangedHandler(object sender, EventArgs e)
{
((sender as Entry).Handler.PlatformView as TextBox).GotFocus += OnGotFocus;
Entry entry = sender as Entry;
(entry.Handler.PlatformView as TextBox).GotFocus += OnGotFocus;
}

partial void ChangingHandler(object sender, HandlerChangingEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public partial class CustomizeEntryPartialMethodsPage : ContentPage
{
partial void ChangedHandler(object sender, EventArgs e)
{
((sender as Entry).Handler.PlatformView as UITextField).EditingDidBegin += OnEditingDidBegin;
Entry entry = sender as Entry;
(entry.Handler.PlatformView as UITextField).EditingDidBegin += OnEditingDidBegin;
}

partial void ChangingHandler(object sender, HandlerChangingEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ public CustomizeEntryHandlerLifecyclePage()

void OnEntryHandlerChanged(object sender, EventArgs e)
{
Entry entry = sender as Entry;
#if ANDROID
((sender as Entry).Handler.PlatformView as AppCompatEditText).SetSelectAllOnFocus(true);
(entry.Handler.PlatformView as AppCompatEditText).SetSelectAllOnFocus(true);
#elif IOS || MACCATALYST
((sender as Entry).Handler.PlatformView as UITextField).EditingDidBegin += OnEditingDidBegin;
(entry.Handler.PlatformView as UITextField).EditingDidBegin += OnEditingDidBegin;
#elif WINDOWS
((sender as Entry).Handler.PlatformView as TextBox).GotFocus += OnGotFocus;
(entry.Handler.PlatformView as TextBox).GotFocus += OnGotFocus;
#endif
}

Expand Down

0 comments on commit 0404227

Please sign in to comment.