© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
4 replies
Falco

How to refer to the mainwindow class from another class.

Creating a WPF app. I have one main class where all the mainwindow controls are operated.
 public partial class MainWindow : Window
 {
     public MainWindow()
     {
         InitializeComponent();
         InitializeAPIs();
     }
 public partial class MainWindow : Window
 {
     public MainWindow()
     {
         InitializeComponent();
         InitializeAPIs();
     }

I have a different class that's called FilterManager. In this class I want to operate some data on the mainwindow as well. But I'm not sure how, what's a clean way to refer to the mainwindow from this class?
    internal class FilterManager
    {
      // Reference to MainWindow here
    }
    internal class FilterManager
    {
      // Reference to MainWindow here
    }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How to access variable from another class?
C#CC# / help
3y ago
❔ Accessing variable from another class
C#CC# / help
3y ago
❔ ✅ How to call a specific attribute from a getter class to another class
C#CC# / help
3y ago