Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

C# WPF- Changing label content automatically

$
0
0

Hello,

I want the sentences to change automatically every second while program running. I tried but need help

For example;

1- Hello,

2- My name is

3- Max

"This will change automatically" = label1.content

"Hello," = label1.content

"My name is" = label1.content

Like this one but specific sentences.

"Test8" = label1

            var length = 1000;

            Task.Run(() =>
            {
                for (int i = 0; i <= length; i++)
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() => {
                        label1.Content = "Test" + i;
                    }), DispatcherPriority.Render);
                    Thread.Sleep(100);
                }
            });



Viewing all articles
Browse latest Browse all 18858

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>