问题描述:

We have an Intermec touchscreen terminal (OS: Win7).

We use an application on it that uses an on-screen keyboard stored in xaml files (VTFKey, VTKey, VTKeyCaps, VTKeyShifted, VTKeyShiftedCaps).

I pasted the code from VTKey.xaml for the buttons that toggle between keyboard panels (the xaml files mentioned above):

<Button Canvas.Top="105.545" Height="49.995" Width="125" Command="{Binding Path=PressAndRelease}" CommandParameter="VK_CAPITAL" Content="Cap" />

<Button Canvas.Left="724" Canvas.Top="208.692" Height="50" Width="90" Command="{Binding Path=PressAndRelease}" CommandParameter="VK_TOGGLE" Content="Toggle" />

<Button Style="{DynamicResource ShiftKey}" Canvas.Left="836.583" Canvas.Top="156.651" Height="50" Width="163.317" Command="{Binding Path=PressAndHold}" CommandParameter="RSHIFT" Content="Shift" />

网友答案:

My question would be how do these commands (VK_CAPITAL, VK_TOGGLE, RSHIFT) know which xaml file to change to?

You have XAML for the following three Buttons:

<Button Canvas.Top="105.545" Height="49.995" Width="125"
    Command="{Binding Path=PressAndRelease}" CommandParameter="VK_CAPITAL" 
    Content="Cap" />
<Button Canvas.Left="724" Canvas.Top="208.692" Height="50" Width="90" 
    Command="{Binding Path=PressAndRelease}" CommandParameter="VK_TOGGLE" 
    Content="Toggle" />
<Button Style="{DynamicResource ShiftKey}" Height="50" Width="163.317" 
    Command="{Binding Path=PressAndHold}" CommandParameter="RSHIFT" 
    Content="Shift" />

Note the Command property... this is the name of the ICommand instance that performs the functionality for each Button. Two of these Buttons use the PressAndRelease Command. In this case, the CommandParameter is also used... inside the PressAndRelease Command code, you would probably see something like this:

if (parameter == "VK_CAPITAL") LoadVkCapitalView();
...
else if (parameter == "VK_TOGGLE") LoadVkToggleView();

As for the last part of your question, you'll have ask a more precise question for me to be able to answer it.

相关阅读:
Top