title: SharpDX.Xinput Check if A button is being held down instead of being pressed
body: <p>I am trying to check if I press and hold the A button on my xbox controller. Right now i have it so i can see if my button is being pressed but not being hold. This is the code i'm using right now to see if its being pressed.</p>
  
  <pre><code>private void Loop()
      {
          while (true)
          {
              var state = _controller.GetState();
              var LX = state.Gamepad.LeftThumbX;
              var LY = state.Gamepad.LeftThumbY;
              var magnitude = Math.Sqrt(LX * LX + LY * LY);
              if (magnitude &gt; _deadzone)
              {
                  MoveCursor(LX, LY * -1);
                  Thread.Sleep(20);
              }
              if (state.Gamepad.Buttons == GamepadButtonFlags.A)
              {
                  LeftClick();
                  Thread.Sleep(100);
              }
              else if (state.Gamepad.Buttons == GamepadButtonFlags.B)
              {
                  RightClick();
                  Thread.Sleep(100);
              }
          }
      }
  </code></pre>