Pergunta

<Grid x:Name="LayoutRoot">
    <TextBox x:Name="TxtFocusOut" Height="74" Margin="186,149,225,0" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="26.667" TextChanged="TextBox_TextChanged"/>
</Grid>

private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
    {
        if(TxtFocusOut.Text.Length>=4)
        {
            MessageBox.Show("Four you typed four values");
        }
    }

After I clicked Ok Button On message box,the cursor should be focused out from the texbox.But now it is Blinking in the textbox.What should i do to focused out from the testbox?

Foi útil?

Solução

FocusManager.SetFocusedElement(AnotherElementID);  

by doing this the this will loose its foucs and foucs can be use for another element.
or
Keyboard.ClearFocus();
http://msdn.microsoft.com/en-us/library/system.windows.input.keyboard.clearfocus.aspx
try any of these

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top