相关疑难解决方法(0)

如何仅在xaml中设置自动对焦?

是否可以将自动对焦设置为我的xaml文件中的文本框?

<Window x:Class="WpfApplication1.Views.Test1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Height="100"
            Width="210"
            WindowStartupLocation="CenterOwner"
            ShowInTaskbar="False"
            Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
            ResizeMode="CanResizeWithGrip">
    <TextBox HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" AcceptsReturn="True" Text="{Binding Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Window>
Run Code Online (Sandbox Code Playgroud)

wpf xaml textbox autofocus

26
推荐指数
4
解决办法
2万
查看次数

标签 统计

autofocus ×1

textbox ×1

wpf ×1

xaml ×1