TextBox.CandidateWindowBoundsChanged イベント

定義

Input Method エディター (IME) ウィンドウが開いたり、更新されたり、閉じたりしたときに発生します。

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

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

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

イベントの種類

ここで、四角形は TextBox の下に配置されます。 Input Method エディター (IME) ウィンドウの境界が変更されると、TextBox の下部の Margin は、Input Method エディター (IME) 候補ウィンドウの高さによって増加します。 その結果、四角形はその量だけ押し下げられ、候補ウィンドウの対象になりません。

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

注釈

イベント データについては、「 CandidateWindowBoundsChangedEventArgs」を参照してください。

ユーザーは、テキスト入力ボックスのすぐ下のウィンドウに表示される Input Method エディター (IME) を介してテキストを入力する場合があります (通常は東アジア言語の場合)。 [Input Method エディター (IME)] ウィンドウには、ユーザーがテキストを入力するときに表示する必要がある可能性があるアプリ UI の重要な部分をカバーできます。 このイベントは、Input Method エディター (IME) ウィンドウが現在表示されている座標をアプリに通知します。 この情報を使用すると、Input Method エディター (IME) ウィンドウと競合しない場所に UI を描画できます。

DesiredCandidateWindowAlignment プロパティを使用して、テキスト入力ボックスに対する Input Method エディター (IME) ウィンドウの優先配置を指定することもできます。

適用対象

こちらもご覧ください