Click here to Skip to main content
15,891,764 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi anyone got excwption like this..pls i need some help....


Cannot create instance of 'Window1' defined in assembly 'Demo_Keyboard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Demo_Keyboard;component/Window1.xaml' Line 1 Position 9.
Posted

It's hard to tell without seeing the actual code.
Maybe you have renamed class and didn't update xaml file after this.
Maybe you have changed its namespace and didn't update xaml file.
Probably there are other possible reasons for this
 
Share this answer
 
Whenever you see an issue like this, it's pretty much guaranteed that something you are relying on to bind to or affect the display has failed (and failed pretty catastrophically). If you add a DispatcherUnhandledException handler into your App class, you should be able to catch the actual exception there, and see what's going wrong.

Update by Tarun:
Check out this link on how to use it. http://www.codeproject.com/Answers/191167/WPF-Application-exits-automatically#answer1[^]
 
Share this answer
 
v2
Comments
Tarun.K.S 1-Jul-11 6:42am    
Hi Pete, updated the answer with a link. I just remembered that you had answered this before. :)
5+
Pete O'Hanlon 1-Jul-11 6:44am    
Cheers mate. I knew I'd answered this before - I was just too lazy to go and find it;)
C#
public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            this.Topmost = true;
>>>HERE>>>>  this.WindowGrid.Children.Add(new Window2(this));

        }
    }



here im gettin the exception...i need jus one correct loophole to fin tis exception..
 
Share this answer
 
Comments
Pete O'Hanlon 1-Jul-11 6:36am    
Is Window2 a Window or a UserControl? If it's a window, you can't add it into another window like this.
Ahn_7 1-Jul-11 6:57am    
ya exactly im using a window2...bt i dont want usercontrol..then pls help me instead of usercontrol what i can use ter...
Mark Salsbery 1-Jul-11 12:41pm    
You can use any other UIElement derived class object besides Window. Depends on what you want there.
Philippe Mori 23-Aug-11 9:02am    
This is not an answer. Please improve your question instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900