I bought a moisture sensor like this recently.

After some research, there seem no articles to indicate how to use it in Windows 10. So I figured out myself.

This sensor has 4 Pins, which are:

PIN Usage
AO Analog Out
DO  Digital Out
GND  Ground 
VCC  Power

So, let's connect VCC to DC3.3v on RPi, I use PIN 01. Connect GND to any ground header, which I use PIN 09. DO to any free GPIO header, I use 21. A complete reference of the Raspberry Pi 3 GPIO Headers is shown in the below picture.

The completed wire connection is this:

After power on the Raspberry Pi, we should see the power LED turns on:

Adjust the blue knob to calibrate the sensor not to be triggered (DO LED is not on) in dry air.

Use a cup of water to test if DO-LED can be triggered. If it is on as soon as the sensor touches water, then calibration is done, we can go on to write code.

The sensor will output GPIO High in dry air, and GPIO Low in water. Based on this fact, my code will be: 

public GpioPin MoistureSensorOutputPin { get; set; }

public DispatcherTimer DispatcherTimer { get; set; }

public MainPage()
{
    this.InitializeComponent();
    Loaded += OnLoaded;
}

private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
    var ctl = await GpioController.GetDefaultAsync();
    MoistureSensorOutputPin = ctl?.OpenPin(21);
    if (MoistureSensorOutputPin != null)
    {
        MoistureSensorOutputPin.SetDriveMode(GpioPinDriveMode.Input);
        DispatcherTimer = new DispatcherTimer()
        {
            Interval = TimeSpan.FromSeconds(1)
        };
        DispatcherTimer.Tick += (O_O, n_n) =>
        {
            var pinValue = MoistureSensorOutputPin.Read();
            if (pinValue == GpioPinValue.High)
            {
                Debug.WriteLine("Dry");
            }
            else
            {
                Debug.WriteLine("Water Detected!");
            }
        };
        DispatcherTimer.Start();
    }
}

Please pay attention not to use this event handler:

public event TypedEventHandler<GpioPin, GpioPinValueChangedEventArgs> ValueChanged;

Because this will output the result multiple times like this: