Pavel Durov
Pavel Durov

Reputation: 1297

Windows phone keyboard open events and properties

On my Windows Phone app I need to change my view accordingly to my keyboard. I have several questions:

How can I identify that the keyboard is opened? Is there an event on view for keyboard opening?

Is there a way to get the height of the keyboard? Or the area size of the blocked UI (by keyboard)?

Upvotes: 1

Views: 513

Answers (1)

Tomasz Pikć
Tomasz Pikć

Reputation: 763

You can access to keyboard information by Windows.UI.ViewManagement.InputPane class. There is static method GetForCurrentView(). It returns InputPane for current view. InputPane has events Hiding and Showing and property OccludedRect which returns region that input pane is covering.

InputPane inputPane = InputPane.GetForCurrentView();
inputPane.Showing += OnInputPaneShowing;
inputPane.Hiding += OnInputPaneHiding;

Rect coveredArea = inputPane.OccludedRect;

Upvotes: 5

Related Questions