Posted 15 years ago
by Brette Esterbrooks
Version: 9.2.0511
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
I have a Int32 text box on a screen. If I set focus to the control when the screen is first loaded the cursor does not appear in the control. We know by looking at snoop that the control does actually have focus however the first "part" within the control does not. This makes me sad.
<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Editors="clr-namespace:ActiproSoftware.Windows.Controls.Editors;assembly=ActiproSoftware.Editors.Wpf30"
Loaded="Window1_OnLoaded"
Title="Window1"
Height="300"
Width="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Column="0">Case Number</Label>
<Editors:Int32EditBox Grid.Row="0"
Grid.Column="1"
Name="txtCaseNumber"
Width="100"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
</Grid>
</Window>
using System.Windows;
namespace WpfApplication3
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void Window1_OnLoaded(object sender, RoutedEventArgs e)
{
txtCaseNumber.Focus();
}
}
}