Dela via


RichEditBox.CandidateWindowBoundsChanged Event

Definition

Occurs when the Input Method Editor (IME) window open, updates, or closes.

// Register
event_token CandidateWindowBoundsChanged(TypedEventHandler<RichEditBox, CandidateWindowBoundsChangedEventArgs const&> const& handler) const;

// Revoke with event_token
void CandidateWindowBoundsChanged(event_token const* cookie) const;

// Revoke with event_revoker
RichEditBox::CandidateWindowBoundsChanged_revoker CandidateWindowBoundsChanged(auto_revoke_t, TypedEventHandler<RichEditBox, CandidateWindowBoundsChangedEventArgs const&> const& handler) const;
public event TypedEventHandler<RichEditBox,CandidateWindowBoundsChangedEventArgs> CandidateWindowBoundsChanged;
function onCandidateWindowBoundsChanged(eventArgs) { /* Your code */ }
richEditBox.addEventListener("candidatewindowboundschanged", onCandidateWindowBoundsChanged);
richEditBox.removeEventListener("candidatewindowboundschanged", onCandidateWindowBoundsChanged);
- or -
richEditBox.oncandidatewindowboundschanged = onCandidateWindowBoundsChanged;
Public Custom Event CandidateWindowBoundsChanged As TypedEventHandler(Of RichEditBox, CandidateWindowBoundsChangedEventArgs) 
<RichEditBox CandidateWindowBoundsChanged="eventhandler" />

Event Type

Examples

Here, a rectangle is placed below a RichEditBox. When the Input Method Editor (IME) window bounds change, the bottom Margin of the RichEditBox is increased by the height of the Input Method Editor (IME) candidate window. As a result, the rectangle is pushed down by that amount and is not covered by the candidate window.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <StackPanel>
        <RichEditBox x:Name="editBox1" Width="300" HorizontalAlignment="Left" 
                 DesiredCandidateWindowAlignment="BottomEdge"
                 CandidateWindowBoundsChanged="OnCandidateWindowBoundsChanged"/>
        <Rectangle Height="100" Width="100" Fill="Red" 
                   HorizontalAlignment="Left"/>
    </StackPanel>
</Grid> 
private void OnCandidateWindowBoundsChanged(RichEditBox sender, CandidateWindowBoundsChangedEventArgs args) 
{ 
    editBox1.Margin = new Thickness 
    { 
        Left = 0, 
        Top = 0, 
        Right = 0, 
        Bottom = Math.Max(0, args.Bounds.Bottom - editBox1.ActualHeight) 
    };
} 

Remarks

For event data, see CandidateWindowBoundsChangedEventArgs.

Users sometimes enter text through an Input Method Editor (IME) that shows in a window just below a text input box (typically for East Asian languages). The Input Method Editor (IME) window can cover important parts of your app UI that the user might need to see while entering text. This event notifies your app of the coordinates where the Input Method Editor (IME) window is currently displayed. You can use this info to draw your UI in a location that doesn't conflict with the Input Method Editor (IME) window.

You can also use the DesiredCandidateWindowAlignment property to specify a preferred placement of the Input Method Editor (IME) window in relation to the text input box.

Applies to

See also