WinUI3: How to capture wifi change event in WinUI3 desktop app

21939029 771 Reputation points


I'm working on the WinUI3 desktop application. How can we receive an event when the network to which the system is connected to is changed?

I tried searching online, but I was not able to find any solutions to receive this event in WinUI3. It would be of great help if you could help me achieve this.

Thank you.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
469 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,751 questions
No comments
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 6,721 Reputation points Microsoft Vendor

    Hello @21939029 ,
    Welcome to Microsoft Q&A!

    You can use Event NetworkInformation.NetworkStatusChanged.

        public MainWindow()  
            NetworkInformation.NetworkStatusChanged += NetworkStatusChanged;  
        private void NetworkStatusChanged(object sender)  

    I remember that your project is Winui3 C++, the following information is for your reference.
    The NetworkConnectivityChanged method is called when network connectivity related changes occur.
    2.Receiving Event Notifications Through WMI

    Thank you.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Oldest