SpeechSynthesizer class provides access to the functionality of an installed speech synthesis engine (voice).
Step 1: Open a blank app and add a Button and A TextBox either from the toolbox or by copying the following XAML code into your grid.
Step 2: Add the following namespaces to your project which is needed in further C# code.
Step 3: Copy and paste the following code to the cs page which will be called on button click and will speak the text in the TextBox.
Step 4: Run your application and test yourself.