Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created February 25, 2014 12:21
Show Gist options
  • Save podhmo/9207824 to your computer and use it in GitHub Desktop.
Save podhmo/9207824 to your computer and use it in GitHub Desktop.
focus
<Window x:Class="FocusSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="TextBox">
<Setter Property="Height" Value="50"/>
<Setter Property="FontSize" Value="40"/>
</Style>
</Window.Resources>
<StackPanel>
<TextBox x:Name="Input"></TextBox>
<Button Height="50" x:Name="Button">
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button, Path=IsMouseOver}" Value="True">
<Setter Property="FocusManager.FocusedElement"
Value="{Binding ElementName=Input}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<TextBox x:Name="DummyInput"></TextBox>
</StackPanel>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment