在纯XAML中选中的行上按Tab键切换到文本框

时间:2014-04-23 04:28:27

标签: c# wpf xaml

我正在开发一些XAML / WPF,我们在其中创建一个表单模板,然后将其编译成一个dll,然后黑盒子应用程序使用此dll将表单呈现给用户。

理想情况下,我应该完全可以在XAML中使用它,但我并不完全了解XAML中可以做什么和不能做什么。

我有以下内容:

<cad:SortableListView.View>
    <GridView DataGridRow.Selected="">
        <GridViewColumn Header="Message #" cad:SortableListView.SortPropertyName="MessageId" DisplayMemberBinding="{Binding Path=MessageId}"/>
        <GridViewColumn Header="Critical" cad:SortableListView.SortPropertyName="Message.IsReceiptRequested" CellTemplate="{StaticResource criticalCellTemplate}"/>
        <GridViewColumn Header="Date/Time" cad:SortableListView.SortPropertyName="Message.SendingTime" DisplayMemberBinding="{Binding Path=Message.SendingTime.LocalDateTime, StringFormat={}{0:G}}"/>
        <GridViewColumn Header="Subject" cad:SortableListView.SortPropertyName="Message.Subject" DisplayMemberBinding="{Binding Path=Message.Subject}"  Width="140"/>
        <GridViewColumn Header="From Terminal" cad:SortableListView.SortPropertyName="Message.SendingTerminal" DisplayMemberBinding="{Binding Path=Message.SendingTerminal}"/>
        <GridViewColumn Header="Sender" cad:SortableListView.SortPropertyName="Message.SendingEmployeeId" DisplayMemberBinding="{Binding Path=Message.SendingEmployeeId}"/>
        <GridViewColumn Header="Priority" cad:SortableListView.SortPropertyName="Message.Priority" DisplayMemberBinding="{Binding Path=Message.Priority}"/>
        <GridViewColumn Header="Event" cad:SortableListView.SortPropertyName="Message.LocalEvent.AgencyEventId" DisplayMemberBinding="{Binding Path=Message.LocalEvent.AgencyEventId}"/>
    </GridView>
</cad:SortableListView.View>
....
More code
....
<TextBlock Grid.Row="3" Grid.Column="0" TextAlignment="Left" Margin="25,0,0,5">
    Reply:
</TextBlock>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=ReplyText}" HorizontalAlignment="Stretch"  Margin="10,0,30,5"/>
<Button Grid.Row="3" Grid.Column="2" Margin="5,0,30,5" DockPanel.Dock="Right"
    Command="{Binding Path=Acknowledge.Command}"
    cad:CreateCommandBinding.Command="{Binding Path=Acknowledge}" IsDefault="True">
    Acknowledge
</Button>

我需要它,以便当从网格中选择一行时,光标必须跳转到文本框,并且当&#34;输入&#34;按下,按钮单击事件被触发。我认为我设法将其设置为默认值(IsDefault =&#34; true&#34;)。它是屏幕上唯一的按钮,所以我不太担心其他事情会被解雇。

同样,理想情况是能够在纯XAML中执行此操作,但如果需要附加文件,请告诉我如何在文件后面引用此代码。

谢谢

0 个答案:

没有答案