Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
i have created wpf application . how to set the startup form as Sample.cs in wpf application
Posted
Updated 17-Apr-12 17:58pm
v2
Comments
Erik Rude 16-Apr-12 9:19am    
Is it not just Project-->Properties-->Application then set startup object or am I missing something?
Henning Dieterichs 17-Apr-12 16:48pm    
With this you set the entry (object/)point, not the startup window.
If you change the startup object in WPF, nothing will work anymore.
Sergey Alexandrovich Kryukov 14-Oct-12 21:30pm    
What do you call "form"? The main class in a WPF application representing a window is called "Window".
--SA
Sergey Alexandrovich Kryukov 14-Oct-12 21:32pm    
[The post by OP as "solution":]

sorry but its not working,

any other solution ??
Sergey Alexandrovich Kryukov 14-Oct-12 21:34pm    
Solution for what?! You question is of the type "help to do who-knows-what", and now you have reply of the type "it's not working". What "it's" and what is "not working"? If you don't want to answer, its OK; you did not ask a reasonable question in first place and cannot expect reasonable help.
--SA

As your question is very inprecise, my answer will be to.

Windows Form != WPF Window
Generally, Visual Studio sets "Window1.cs" as startup window.
(See app.xaml in your project, there is a property "StartupUri" or something like this)
 
Share this answer
 
Comments
Isha Sharma 21-Mar-15 9:26am    
Tryinh it
You can't set startup form sample.cs .cs is code behind.
You set sample.xaml

Open your App.xaml and set Startup Uri Sample.xaml

C#
<pre lang="HTML"><application x:class="MyApp.App" xmlns:x="#unknown">
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Sample.xaml">
    <application.resources>
         
    </application.resources>
</application>
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-Oct-12 21:37pm    
Of course it is quite possible to set a startup window (not form!) in code, without any XAML (but why?). To do it, it's just enough to read the help page on the class "Application". As this answers tells something which is not true, I just had to vote 1, sorry.
--SA

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