Center-Align Form in Windows Form Designer - winforms

I've become accustomed to the WPF designer, I'm wondering if it's possible to align a form in the center of the designer, rather than top-left.

The answer is no. The designer in VS 2010 does not allow the user to situate the form in any other configuration.

The short answer to this question is "No", visual studio does not have this feature. While there are not any good options what I can think of to address this is to take a look at Sharp Develop, an alternative open source solution to Visual Studio and if that does not have this feature in it, you can submit a bug into their issue tracking system and hope someone picks it up. Perhaps if you are feeling frisky enough you can even take on this IDE feature yourself and submit a patch. Like I said, not a good option, but it's an option.

Go the designer view, then go to the start position into the properties, and then set I to the center screen

Related

Can i implement extreme design elements in my app with Visual Studio, or do i need Blend?

I'm new to Visual Studio and Blend and i'm trying to see their difference. I thought that Blend was ideal for adding more design and interactivity into your app so i chose to use this in order to create an app about a virtual museum (which i wanted to include design and 3d elements).
So far i have created 2 Grids. The 1st Grid contains a sign in or sign up option(along with its design for which i used Blend tools). The 2nd Grid is the registation form which i wanted the user to be redirected to after the user has clicked the sign up button. I'm trying to make the transition from grid 1 to grid 2 like if i had two windows forms, but i can't seem to find how i can do that. Any ideas on how to do it?
I tried to open it into Visual studio and it doesn't seem to respond that well.I suppose i must do something wrong.
So taken the previous difficulties, i'm wondering whether Blend is not necessary to use to create this kind of app and i could simply use standard Visual Studio's windows form without having problem adding design elements.
Thanks in advance
Visual Studio has all that you need to be able to do your interfaces as you want them to be. As Glen Thomas said, you should learn how to code in xaml to create your interface. Visual studio gives you a render of what it looks like in real-time while coding it so it might be helpful to do it this way.

Best way for programmers to edit XAML

I was wondering how programmers chose to edit XAML. Most of the programmers I speak to seem to edit the raw XML, but that seems nuts to me since it is such a natural thing for a more visual editor (of course you often have to get down to the raw code ultimately, but isn't there a better way to lay out a grid, or edit a template, or add non c# triggers or manage commands? The one that really set me off was editing a menu -- Visual Studio 1.0 had a better menu editor for C++ than the raw XAML editing experience.)
When I edit .aspx files I use a visual editor much of the time, and then for the raw stuff I get into the html code.
I am aware of Expression Blend, but that seems far more focused on artistic types and GUI experts rather than programmers.
Does anyone have recommendations for a better editor for XAML than VS? Especially so since VS seems to have real nasty problems with XAML editing too, like bugginess and poor performance?
Appreciate your helping this XAML newbie.
I must agree that Blend has the best XAML editor I've tried. While VS2010 has made some significant improvements over 2008, it's not at the same level as Blend, and still feels a little clunky and is prone to freaking-out.
A good option for doing quick and dirty XAML editing is Kaxaml, a small editor which can be thought of as NotePad for XAML. It's fast(er than VS), has syntax-highlighting, auto-completion and an in-editor preview. I find it quite useful to use alongside VS, although it is limited for serious work.
The Visual Studio 2008 visual editor for XAML is still fairly primitive as you've encountered. When it comes down to wanting a true visual editor for XAML files, Blend is your best bet.
Like you, I originally thought Blend was targeted more for designers, but after using it for awhile now, I've found that Blend is clearly the best tool to visually edit XAML files. And since Blend integrates with Visual Studio Team System, you are able to switch between Visual Studio and Blend fairly seamlessly.
I use Blend when I'm doing visual tweaking or setting up Storyboards. I'll sometimes use it when first laying out a window, as well, but I've found that it's often easier to just hand-code the XAML rather than relying on Blend to guess the layout I want. I use Visual Studio when I'm doing XAML editing by hand, as it has better Intellisense and automatic formatting than Blend. I never use the visual editor for WPF in VS.
Part of the challenge here is that XAML layout is much more sophisticated than WinForms, so simple drag and drop doesn't quite cut it anymore. Blend does a pretty good job of guessing what I want, but if I really want to clarify how the visuals should be laid out, it's easier to express by typing the XAML, now that I'm familiar with it.
My typical workflow:
Create the initial layout by entering XAML in Visual Studio for the Grids, StackPanels, DockPanels and what have you that will lay out the window or control. I may also drop in some of the other controls as well, if the layout is simple.
Open up Blend and use it to place smaller controls, edit control properties and create/associate any styles I need. If I need custom control or data templates, I'll create them from Blend and then repeat the VS/Blend process on those templates.
Go back to VS and edit the XAML to set up my designer data context and manually code the data bindings.
Use Blend to verify the look of the finished window or control with the designer data context, tweaking and styling as needed to polish the UI.
I go back and forth a lot, but I'm typically also approaching it from a different mindset with each tool. If I was working with a larger company, I suspect most of what I do in Blend would be handled by a graphical designer, which is I think the intention. I don't mind wearing both hats, though and I've become accustomed to using both tools, as needed.
Visual Studio 2008 isn't the tool to edit WPF window. It falls in error usually if you uses a complex xaml type or some advanced styles.
Visual Studio 2010 has added a lot of new features in editing and specially designer for binding and IntelliSense for xaml too.
Blend is true that is oriented for designers like Microsoft want to sell it but I find it more like the missing feature of the designer of VS.
Blend has an advanced editor for styles and animation and helps a lot to generate.
But Blend lacks terribly in editing raw XAML, it has no IntelliSense at all.
My choice is to use both VS 2010 and Blend specially for styles and animations.
Expression Builder is a good free tool

WPF without Visual Studio?

Would it be practical to create WPF applications without ever touching Visual Studio (or any other IDEs)? As in, coding and compiling completely within Vim and the command-line? What resources would you recommend for someone trying to do so?
It would be possible, since basically WPF is based on XAML - a variant of XML - and C# or VB.NET or another .NET language as its backend language.
The question really is whether that's practical and if it makes sense - I highly doubt it. WPF is all about visual design, e.g. totally without a visual designer (either the built-in one in Visual Studio, preferably the 2010 version; or some other visual designer), it seems a bit silly to want to program WPF....
As for resources - well, a least a text editor is a must, then definitely a few good books on WPF, and you could leverage the C# or VB.NET compiler that comes with the .NET framework.
I have found myself writing XAML in Notepad on a number of occasions where I needed to create a quick UI but couldn't load an IDE. It is really quite trivial, and almost - but not quite - as fast as using an IDE. The main advantages of an IDE such as Blend or VS.NET are in quickly getting things like colors and animations to be "just right."
Another occasion when I frequently write XAML or C# in a text editor is here on Stack Overflow. I only fire up Visual Studio when I need to test something out.
My main recommendations for creating WPF applications without an IDE are:
First you should make proper use of WPF's layout system, using appropriate panels and "Auto" sizing wherever possible. For example, if you want a stack of buttons with some space between them, create a <StackPanel>, and on each button add Margin="4" or whatever. This is good design anyway. Most beginning WPF programmers treat it like WinForms with no layout capability, which is a shame. WPF has a very powerful layout engine and it should be used. If it is, there will never be any need for graph paper or measurements. In addition, your UI will automatically adjust its layout if you change font sizes or objects are larger than expected.
Second you should use msbuild for your project unless it is ultra-simple. msbuild is installed along with NET Framework so it is always available. The file format is very easy to edit with a text editor, and it is much better than a batch file with the appropriate "csc" command because it allows you to use code-behind and is less error-prone when adding new source files.
Third keep a PowerShell command line window open separate from your editor, with a command that runs "msbuild" and then executes your application. To run your app, then just Alt-Tab to this window and hit uparrow, Enter. Some text editors have the ability to execute user-defined commands directly from within the editor and see the output, in which case this second window is not necessary.
Fourth keep a copy of cordbg or mdbg handy. Although an IDE is the ideal place to do your debugging, any debugger is better than none at all. You will find your problems much faster if you stop at breakpoints and examine variables than if you just keep editing code and re-running.
Fifth, use "ColorPad" or a similar application to select your colors for use. Just guessing and entering your best guess in hexadecimal just doesn't work very well.
For resources, I recommend you get the book "WPF Unleashed" and work through the examples. I would also read a lot of other people's XAML, such as can be found on CodePlex.
Possible, Yes. Practical No.
For production work, I would consider Microsoft Expression Blend 3. Then copy the XAML and paste it into the editor of your choice and compile from the command line.
You could download KAXAML . It's a free, lightweight editor. I found it good for learning about XAML and seeing how minor changes and tweaks can impact on an overall design.
XAML is plain old text so find a free editor (KAXAML), use it, and if you must, paste into your editor.
If you really want to go down this route, I'd recommend getting some graph (squared) paper and a sharp pencil.
Draw out your designs on that, read off the positions and type them into your editor of choice.
One benefit of this is that you're going to have a paper prototype to show people ;)
As James Keesey points out in his comment on marc_s's answer, your edit-compile-test cycle is going to be painful.
It's definitely possible. I'd say it's not practical, though.
To be honest, I do professional WPF development and I do it with the visual designer closed. I'm much more comfortable editing the XAML by hand, just like I write HTML. However, the benefits of an IDE go far beyond the visual designer. There's IntelliSense, debugging and a whole host of other invaluable features.
Really, I must question your motives. What are you trying to gain? Visual Studio Express editions fully support WPF development, so it can't, or shouldn't, be a cost issue.
The newest version (3.0) now supports the wpf template.
Just download it from: https://dotnet.microsoft.com/
Just type in console:
dotnet new wpf -o wpfHello
cd wpfHello
code .
Greetings :-)

Why do my toolbox items disappear in Visual Studio 2008?

I'm working on a solution that contains multiple projects targeting Windows Mobile 5 and standard Windows applications.
Lately when opening up a form in designer the common UI controls (textbox, button, label, etc etc...) have vanished leaving only the controls defined within the project.
Resetting the toolbox has no effect. A google search suggested deleting the toolbox temp files in the Local Settings\Application Data\Microsoft\VisualStudio\9.0, however this was only successful in bringing back the default controls for Windows Mobile 5. The WinForms controls are still mysteriously missing.
Also, if I right-click and Select All on the toolbox, all of the WinForms controls do in fact come up, however they're all grayed out.
Has anyone else experienced this?
I just had a similiar problem. In a managed C++ project all the default toolbox items disappeared form the winforms designer. After playing around for a while I found that there was a problem in the .vcproj file.
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="COLLADA Import"
ProjectGUID="{0DEEF9B6-1929-44E3-92EC-13712839FB63}"
RootNamespace="COLLADAImport"
Keyword="ManagedCProj"
TargetFrameworkVersion="0"
>
When you set TargetFrameworkVersion to a valid number, for example 131072 for .Net 2.0, the toolbox items will be back.
If you right click on the Toolbox and select 'Choose Items...' and then sort by the 'Namespace' column, you can then select the ones you need (for example System.Windows.Forms for WinForms).
You can multiselect with Shift and then select/deselect the group.
The controls then reappear in the Toolbox as enabled.
I've noticed this exact same thing for regular WinForms as well. I can't speak to mobile applications but in regular winforms this has a tendency to happen.
I believe it's actually a bug in Visual Studio.
There are some things you can do (again, for WinForms. I'm not sure about mobile) with adding attributes to your control. Such as:
[ToolboxBitmap(typeof(MyControl), "MyControlBitmap")]
There are some other useful related things on this site:
http://en.csharp-online.net/Design-Time_Integration-Attributes
I had exactly the same problem (after installing Windows Mobile SDK all items in the toolbox were greyed out).
I've startet the Visual Studio 2008 command line as administrator and started the following command (WARNING - all your settings are lost !!)
devenv /setup /resetuserdata /selfreg /resetskippkgs
After that the toolbox looked fine and worked like on the first day.
The idea came from this thread: connect.microsoft.com
Go to the Tools menu and choose import & export settings, then choose the 'reset all' setting, then yes. Save your current settings, after that you'll have your toolbox reappear.
Actually you may be able to add a registry key to get this to work also.
Make sure you're not in Debug mode.
If you are running Visual Studio 2008 under vista, try running it as an Administrator. Right click on the shortcut and select Run as Administrator.
Well guess what install Service pack 1 for VS 2008 and it would go away and if you have wireless mouse and keyboard turn it off. Choose one of these two both work.

WPF design rendering is dramaticaly slow Visual Studio 2008? Are there any tweaks that could speed it up?

I just wanted to do some tutorials in WPF but I find that the designer works very slow in comparision to Windows Forms/GDI+.
Are there any tweaks to speed it up?
If you're just after a bit of XAML editing, you can use a separate editor, such as XamlPad. That has much quicker rendering than the VS designer.
I turned it off.
Right click the xaml file in Solution explorer,
use Source code (Text) Editor
Set it as default
Good thing is Intellisense still works!
In case you need to view the Design view occasionally, you can still Right click -> Design view.
Turn it off. The VS XAML designer is awful and doesn't work anyway as soon as your XAML is non-trivial. Go into your options and map the .xaml extension to the regular XML Editor.
you can look in the following link.
quite same as the previous answers."How to speed up Visual Studio 2008's slow WPF designer"

Resources