I have been using Visual Studio 2013 (Downloaded ISO-version) express C# winforms for some months now and i wanted to start using wpf (because of the design possibilities ), however when i start a new WPF C# project I only get MainWindow.xaml and MainWindow.xaml.cs. i have read on many different pages about this and I've tried repairing VS and pressing CTRL + F7 while in the WPF project and many other things, but none of them works.
I can start the program without difficulty and a window which seems to be the standard window appears. and in my solution Explorer there is nothing related to the word design so i don't think its there either.
I would be grateful for any answer. :)
If you are only seeing the XAML, your design view may be collapsed. There is a small button on the bottom right of the XAML pane that allows you to collapse/uncollapse the design view. I have included pictures, the first of which highlights the button, and the second shows the result.
I would encourage you though to use the design view only as a preview window, if at all. The idea of dragging and dropping and positioning controls via the design view is very winforms style of thinking, and in WPF you want your positioning to be more relative to your layout containers. Personally, I do not use the design view at all when I am doing wpf, as I find it becomes easy to read your markup and see it in your head.
Related
I am coding a C# forms application where I am wanting to have the layout of my application to have a similar style of the Visual Studio 2013 layout. By this, I mean to have a property grid at the lower right of the screen, a solution explorer to the top right of the screen, tabs for the content and a toolbox.
Do I need to use a FlowLayout control for this? I have previously found some sample code with this layout all coded to use as a template, however I cannot seem to find this after doing a search. What is the correct terminology for this layout style? Also, is there a Microsoft sample for this?
Here is an image of what I am looking for:
Thanks.
You can use the following readily made controls from Visual Studio:
System.Windows.Forms.PropertyGrid for the properties
System.Windows.Forms.TreeView for the solution explorer
For the toolbox you will need to create a custom-control, with search box and dropdown tabbing of pages. See making of custom controls here:
https://msdn.microsoft.com/en-us/library/vstudio/6hws6h2t(v=vs.100).aspx
http://www.codeproject.com/Articles/2016/Writing-your-Custom-Control-step-by-step
Struggling, I need a button to open up a window but below the MainWindow in C#. Like in a website you can open other pages but the master page layout doesn't change only the page you are viewing shows differently.
I need similar thing. I have components (tools i added from toolbox) on my MainWindow.xaml so for example if i click on a button i named new student, a tabbed-window where i can capture student details must appear but it must not be a separate windows it must appear within the mainwindow and seem like a one thing. Forgive for my English. I hope someone will understand me though, thanks in advance. I want to have components/functionality according a specific button click but constant Mainwindow, the one with "File" "Edit" "View" "Help".
There are a couple different solutions to you problem, but Visual Studio doesn't quite have something like the Master View option through ASP .NET with webforms.
Option One
Using TabControl. This option is the easiest solution to your problem. The GUI in Visual studio has support for adding components to each tab, which nothing else has. This is the closest component to something like multi-panels in Java, but it will still create the Tabs, which may not be what you are looking for.
Option Two
Using multiple Panels over one another. With this option, you can add multiple panels to your main window and layer each panel over one another. You can add a button or other control which will hide each panel and all of its contents. This is a great solution if you don't want tabs, but it can be frustrating to create in Visual Studio since you must move each panel away from another in order to add/remove/adjust the components on the underlying panel.
Of course there are still a few more controls you can use to produce the results you are looking for, but these are probably the most applicable solutions to your problem.
I created a WPF form in Blend and now I want to bring this form into VS2012 so I can start putting code to the buttons, etc. I cannot open projects from VS2012 directly into blend the shortcut to do this isn't there, but I can edit my Blend project in VS2012. When I do this and run the project in VS2012 I see the form as expected which I've created in blend. The problem is in VS I cannot find the actual form anywhere to work with, I can only edit the files themselves. Not sure if I'm doing something silly, but I'm trying to click into buttons to create events like I would normally. Any ideas what I'm missing?
When I open other WPF projects that I started in VS2012 (not blend) the form comes right up for me to interact with.
In VS open the xaml for the form. If you can't see the designer, look at the bottom of the xaml window, there should be some tabs there: XAML, Design and Document Outline. Selected Design will switch your view from the Xaml to the 'Form view' (the designer). If you look on the right there are some buttons for changing the view to a split view, either vertically or horizontally that allow you to see both the Xaml and the design at the same time. You can end up in the state where you don't see the form if you expanded the xaml view to fill the pane.
The horizontal view will look like this:
I keep seeing these odd looking numbers on just one of the forms in my application. Any idea why this appears - this doesn't cause any trouble in running the application, but I need to make some changes in the design and the regular selection borders are not visible.
These may be the tab orders, but couldn't find out how to remove/ hide these.
All help would be appreciated.
Upen
Got the answer guys- in the main vs2010 main menu- go to View--> taborder - click to toggle off or on.
As part of a school project, a group and I will develop a Windows application using C#.
We are not very experienced in C# but has some basic understanding for it. We do however have experience from other languages and platforms.
We would like to build an application in which the layout is split into two primary parts: the menu, which will reside to the left and the content which will be to the right.
The menu will be more or less static and when an entry in the menu is chosen, the content will be changed.
We have not been able to figure out the best way for achieving this nor have we been able to find good material on this. The idea is to have one window and add a view (as far as I can understand, this should be a UserControl?) to this window. This control will be the menu.
Now, our question is if anyone can point us in the right direction to achieve the navigation in the program. Say, when a menu entry is clicked, how will we change the content of the window and how will we manage which view is active? I suppose that every view (in the "content area") will have a controller.
We are interested in the "best practices" for this when using WinForms and the MVC pattern.
We hope that someone can help us further in this project.
If I were you I would seriously consider using WPF instead of winforms.
It, and the use of the MVVM pattern, allows you to do some pretty impressive stuff with far less code than if you are using winforms. If you don't already know winforms then it might also be a slightly less steep learning curve as WPF is a better thought out framework (at least in my opinion).
If you go the WPF route spend some time getting to understand how bindings work and how to bind your ViewModel to the UI. Once you have a good understanding of proper UI separation you are able to do far more than you could with the old WinForms framework.
I found this link quite useful when I first started looking at WPF. Especially the RelayCommand.
If you are using Winforms the options that you have got is:
-dynamically clearing forms and generating content on menu navigation
-using mdi container form, which can be parent to a number of child forms
If you are using for WPF you could use Pages in a Frame control loaded based on used menu selection. You could also use MVVM pattern to build your app.