Dela via


FlightStick.GetButtonLabel(FlightStickButtons) Method

Definition

Retrieves the button label for the specified button.

public:
 virtual GameControllerButtonLabel GetButtonLabel(FlightStickButtons button) = GetButtonLabel;
GameControllerButtonLabel GetButtonLabel(FlightStickButtons const& button);
public GameControllerButtonLabel GetButtonLabel(FlightStickButtons button);
function getButtonLabel(button)
Public Function GetButtonLabel (button As FlightStickButtons) As GameControllerButtonLabel

Parameters

button
FlightStickButtons

The button for which to retrieve the label.

Returns

The label for the specified button. If the button label is blank or there is no known label for the controller's button, then None is returned.

Remarks

The following example gets the label on the FirePrimary button on the flight stick, and shows an icon based on the label.

#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;

void ShowFlightStickFirePrimaryButtonIcon(FlightStick flightStick)
{
    GameControllerButtonLabel label =
        flightStick.GetButtonLabel(FlightStickButtons::FirePrimary);

    switch (label)
    {
        case (GameControllerButtonLabel::RightTrigger):
        {
            // Show the right trigger icon.
        }
        // ...
    }
}

Applies to

See also