Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:56:51+00:00 2026-06-12T04:56:51+00:00

I have a Windows Tray project that opens a WPF window when Settings is

  • 0

I have a Windows Tray project that opens a WPF window when Settings is clicked. The WPF window opens and displays some of the content properly, but I have two lists that are bound to another class that have odd behavior.

These lists are displayed on two different tabs as devices. On one tab, there is a graphical representation from which the device can be started, and the other tab shows the settings for the device. Everything works perfectly when the WPF application is set as the startup project. However, when I start it from the tray, the lists load correctly, and display in the first tab, where they can be started, but the second tab shows no devices present. They are both linked to the same data.

At first, I thought that there was an issue with binding, but after several days of trying to resolve this, I believe the problem is with App.xaml, where there is a reference to a resource. I suspect that since i am not referencing App.xaml, the resource is not loaded, and the list is not being set up properly. The only difference between the project working and not working is that one has the WPF as startup project, and the other uses the tray to call the WPF.

My question, then, is how do I reference App.xaml to ensure that I load the required resource.

Below is some of my code, in case it might help.

App.xaml

<Application x:Class="Sender_Receiver.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Shell.xaml">
<Application.Resources>
    <ResourceDictionary Source="Themes\Generic.xaml"/>
</Application.Resources>

Current call to open the WPF

        private void settingsEvent_Click(object sender, EventArgs e)
    {
        gui = new Sender_Receiver.mainWindow(); // mainWindow() located in Shell.xaml
        gui.Show();
    }

Code to display the devices. A collapsibleSection implements Expander and RepeatControl implements ItemsControl.

<c:CollapsibleSection Header="Senders">
        <c:CollapsibleSection.CollapsedContent>
            <c:RepeatControl Margin="30,0,0,0" ItemsSource="{Binding SendersList}"  
                              ItemType="{x:Type m:Sender}"  List="{Binding SendersList}"  
                              ItemTemplate="{StaticResource SenderSummary}"/>
        </c:CollapsibleSection.CollapsedContent>
        <Border BorderThickness="1" BorderBrush="Chocolate" Margin="30,0,0,0">
            <c:RepeatControl  ItemsSource="{Binding SendersList}"  
                                  ItemType="{x:Type m:Sender}" 
                                  List="{Binding SendersList}"  
                                  ItemTemplate="{StaticResource SenderTemplate}"/>
        </Border>
    </c:CollapsibleSection>

The image below shows how the application is behaving under different conditions.

WPF does not display all data when called from the Tray.

Any assistance would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:56:52+00:00Added an answer on June 12, 2026 at 4:56 am

    I finally figured this one out. Instead of instantiating the UI, the entire WPF application must be called to run. This will cause the App.xaml to load the dictionary, and other WPF forms can then access it. This is done with the following code:

    private void settingsEvent_Click(object sender, EventArgs e)
        {
            if (gui == null)
            {
                gui = new App();
                gui.MainWindow = new mainWindow();
                gui.InitializeComponent();
            }
            else
            {
                gui.InitializeComponent();
                gui.MainWindow.Show();
                gui.MainWindow = new mainWindow();
            }
        }
        private static App app = new App();
    

    You must keep adding the mainWindow back to the App, as it seems to be set to null when the window shows.

    This was discovered through experimentation, so i am sure it is not the best practice, but it works, and right now, that was what I needed.

    EDIT

    For my purposes, however, this still was not working. I could either open the Settings window only once, or I could not get an event handler to work on it the first time it was open. Finally, Josh came up with the correct answer:

    Process myProcess = new Process();
    myProcess.StartInfo.UseShellExecute = false;
    myProcess.StartInfo.FileName = "C:\\mysettingsapp\\mysettingsapp.exe"; // replace with path to your settings app
    myProcess.StartInfo.CreateNoWindow = false;
    myProcess.Start();
    // the process is started, now wait for it to finish
    myProcess.WaitForExit();  // use WaitForExit(int) to establish a timeout
    

    His full explanation can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C++ Win32 application that was written as a Windows GUI project,
I have a Windows Application that I have created that utilizes the system tray
I have a function that shows a balloon tray in Windows it has a
I have Windows Forms UI, that allows me to enter format for string formatting
We have written a custom windows service (VB.NET, .NET Framework 2.0) that takes a
I have a .net windows forms application that needs to open directly to the
We have written an application that manages OpenVPN from the tray as an add-on
I'm writing an application that will have an option to run on Windows Startup.
I have been trying to deploy my WPF app, I created a Setup Project
I have an application that runs in the sysetm tray, is it possible to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.