在其他模型

时间:2017-11-10 11:10:24

标签: c# wpf xaml

这是我的xaml代码 -

<Grid>
    <Grid Grid.Row="0" Background="Black"  >
    </Grid>
    <Image 
        Grid.Row="1"
        Source="{Binding BackgroundImage, Mode=OneWay}"
        Stretch="UniformToFill"
        StretchDirection="Both" />
    <Grid Grid.Row="0" ClipToBounds="true" KeyboardNavigation.TabNavigation="Local" >
        <TextBox x:Name="TxtScanSearch"
                 Margin="50, 6, 6, 6"
                 Width="300"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Center"
                 Grid.Column="1"
                 Text="{Binding PosApplication.ActiveTransaction.UserInput,
                                Mode=TwoWay,
                                UpdateSourceTrigger=PropertyChanged}"
                 >
            <TextBox.InputBindings>
                <KeyBinding Key="Escape" Command="{Binding Commands[CloseCommand], Mode=OneWay}" />
                <KeyBinding Key="Down" Command="{Binding Commands[ItemDownCommand], Mode=OneWay}" />
                <KeyBinding Key="Up" Command="{Binding Commands[ItemUpCommand], Mode=OneWay}" />
                <KeyBinding Key="F12" Command="{Binding Path= PosViewModel.Commands[InvokeButtonCommand], Mode=OneWay}" CommandParameter="F12" />
           ----------------This one not working     
            </TextBox.InputBindings>
        </TextBox>


    </Grid>

钥匙F12在这里不起作用。 我在“PosViewModel”模型中注册了“InvokeButtonCommand”命令

RegisterCommand("InvokeButtonCommand", param => ExecuteInvokeButtonCommand(param));

所有其他命令按预期工作但是这个。请帮忙

0 个答案:

没有答案