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

  • SEARCH
  • Home
  • 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 6049323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:33:50+00:00 2026-05-23T07:33:50+00:00

Very simple problem but I’m making no progress so I thought I should ask…

  • 0

Very simple problem but I’m making no progress so I thought I should ask…

I’m writing a small WPF prototype where I placed the boot
up logics where I believe it belongs: In (the overridden) App.OnStartup method.

The problem is the method never gets called and I have no idea why!

I browsed around some and found someone saying the <Application> tag in App.xaml must specify the implementing class (App) in the “x:Class” attribute. I changed it from x:Class="Application" to x:Class="App" but it made no difference.

What am I missing here?

EDIT:
Here’s the code…

XAML:

<Application
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="App"
    ShutdownMode="OnMainWindowClose"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Recources\Brushes\Brushes.xaml"/>
                <ResourceDictionary Source="Recources\Templates\Templates.xaml"/>
                <ResourceDictionary Source="Recources\Styles\GVSStyles.xaml"/>
                <ResourceDictionary Source="Recources\Styles\TimePicker.xaml"/>
                <ResourceDictionary Source="Recources\Icons\GVSIcons.xaml"/>
                <ResourceDictionary Source="Recources\Icons\BottleIcon.xaml"/>
                <ResourceDictionary Source="Recources\Styles\BusyAnimationStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Code behind…

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);

    // lower default framerate from 60 to 20 to save CPU ...
    Timeline.DesiredFrameRateProperty.OverrideMetadata(
        typeof(Timeline),
        new FrameworkPropertyMetadata { DefaultValue = 20 });

    hookUpViews();
    connectToServer();
}
  • 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-05-23T07:33:51+00:00Added an answer on May 23, 2026 at 7:33 am

    Edit: Your XAML seems to not be associated with the code behind, the x:Class needs to include the namespace of your App class. e.g. MyWpfApplication.App.


    Unless you post some code you just get wild guessing, here’s mine: You didn’t properly override the method but hide it with a method of the same name and signature.

    This is what a working override should look like:

    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        MessageBox.Show("!");
    }
    

    As suggested you can use the Startup event instead, but you don’t have to, further the StartupUri will be executed in addition to the code in the override.

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

Sidebar

Related Questions

I have a very simple problem but cannot find a nice solution. I have
This may be a very simple problem, but I couldn't find an answer googleing
I have a very simple problem and a solution that will work, but I'm
I am sure this is a very simple problem, but I am new to
The problem: making a very simple style switcher with js (without inline event handling).
Very simple problem...but weird results. Im just trying to fill a drop down list
Very simple problem, but can't seem to solve it. I'm probably just not thinking
Trying to solve a very simple problem using mvvm-light, but after days of sifting
This seems like a very simple problem, but I cannot get a scrollbox to
I have a very simple problem for which though I have a solution but

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.