Beast way for create WPF application layout - wpf

I know how to working layout controls (Grid, StackPanel, DockPanel, etc), but even so, I don't know how to can I combine their for create a good layout.
Has any resource or article talking about this?

You need to look this link for a great place to learn layout techniques.
WPF & Silverlight Layout Controls.
Layout Techniques.
It takes an example WinForm dialog and then goes on to making same for WPF.
Make layouts for all windows programs like Explorer, Control Panel, Picture viewer, etc. Making more and more common layouts will make you more and more comfortable.

Related

Windows Presentation Foundation Adaptive Application

I am new to WPF, i need to know, is it possible to make WPF application responsive, if so, how ?
What i meant with responsive is, all content and controls resize with window resizing accordingly.
This is an extremely general question. The answer would most likely end up being a WPF tutorial, which there are already plenty of.
For your needs, my advice would be to check out the layout system, if you use the correct layouts in the correct spots, your content will resize as you wish.
This link helped me a lot when I started WPF : WPF tutorial #layouts
Its content is limited, so you'll want to look somewhere else eventually, but it does a good job of giving an overview of what is available.
The ones that are most usefull for me are Grid Panel & Dock Panel, ocasionnaly the Stack Panel. Viewbox is usefull for more control on resizing content.
Hope this helps, good luck.

Image Control disapear after it's dragged in Design

I'm a WPF newbie and, unlike WinForms, I have a hard time to setup things in the design window.
My first obstacle is the Image control. After I drag it in the Design window it disappears and there's no way for me to edit its properties (like with the button control for example). The only way to make changes is via the XAML code which isn't very visual and intuitive.
Is there a way to keep editing the Image control in design mode? (example, move it around, select it to view its property panel, etc.)
All you should need to do is give the image control a fixed height and width and it should stay in the designer.
The best thing about the XAML is which separated from code for better re usability like asp.net. It's best you to learn different layouts such as grid, wrappanel, stackpanel etc. Then, you will feel the power of xaml. Else, you can choose the XAML building tools.
Link to refer

wpf vs winforms by means of customizeable UI

Which technology (WPF or Winforms) should be used if UI supposed to be highly customizable like controls layout/design could be change by user and such sort of UI customization.
Kindly mention best practices along to achieve that...
I just recently developed a designer in both WinForms (company req) and WPF (to see how much better it was). WPF has a definate edge, especially when it comes to nicer looking controls and control transparency.
This was my first actual WPF project, other than just messing around, so I was learning as I went. I found this series on creating a diagram designer very helpful. I didn't really do the same things that this article talks about, but more of a hybrid between that and my WinForms app.
I have to admit that the UI functionality was up and running much faster in the WPF version than with the WinForms version.
WPF I have found the easiest to create controls on a fly. Because I can just attach them as child controls to the parent, and the Grids, Dock Panels, just make life easier.
I found WinForms to be clunky to always work with. However I come from a Web background and Xaml makes sense to me.
WPF controls are design and lookless. That means you have a default view of them, but everything detail of a WPF control can be overridden. It's almost akin to using CSS. In the WPF world, you do not create custom controls like you do in WinForms. The main thing in WPF world is "styling" controls and defining a style for them. It just happens that the style also controls the layout and the form of the controls.
WPF is FAR superior for designing and style of UI. Check out these two top WPF companies and tell me if this stuff is easy to do in WinForms:
Cynergy Systems: http://www.cynergysystems.com/
Thirteen23: http://www.thirteen23.com/

WPF ControlTemplate How to

I am very new to WPF, about 4 hours new. I am coming from ASP.net and Masterpages.
I was looking at examples of Control Template that can used to template a window so all windows look the same.
Other post
Can some direct me to an example of how it is accomplished or sample code from start to finish?
Second part:
Is the ControlTemplate the best way to go about building WPF windows client applications? What is best practices in architecting WPF windows applications.
Thanks
There really isn't a "best" way to architect WPF UIs. It all depends on the user experience your application will have.
If you want a very web-like experience you are probably better of using the pages constructs. Otherwise if you have windows, but want a common header, you may just want to make a control template for that. Maybe you need separate windows or maybe you just need to have a sub part of a grid panel change content depending on state... There are different ways to do things that are more or less suited to the type of client experience you want.
Although there are some best practices in relation to using MVC/MVVM design patterns, there isn't a "best" way to style and theme your controls. I don't consider WPF as friendly to newcomers as WinForms were, but at the same time it seems a lot more powerful in the long run. What might help you out are some basic levels of theming:
Styles: these are mainly aesthetic changes to the look and feel of basic controls and elements with some very basic support for triggering things like mouse cursor roll over. They are similar to CSS on webpages.
Control Templates: these are the more heavyweight versions of styles where you actually reconstitute a control so that, say a button can have a textbox inside of it. Where styles work on a logical level where something like a button is the most atomic element, control templates can drill down further into controls so that the border, background, text, etc of a button are seen as separate elements instead of one atomic part.
Data Templates: A more focused version of control templates meant to customize how data items in lists are drawn. If you have a bunch of pictures you don't want the file name to show up in the listbox, you'd rather have the image itself. A data template lets you accomplish this kind of thing.
So you have to ask yourself when you say, "Make all windows look the same," do you mean changes are merely aesthetic/looks (styles), customizing how a collection of items are displayed (data/item templates) or altogether changing how a standard control looks and behaves or making sure the layout of controls on a page are the same across multiple windows/pages (control templates)?
Finally, the "end to end" of the other post you linked to is pretty simple. You take the control template there, and under your tag you simply add Template={StaticResource MyTemplateName} and the template is applied. This article on MSDN is a decent intro to control templating.

Custom painting Windows Forms Scrollbar?

I know how to do custom drawing of a standalone Windows Forms ScrollBar because there are plenty of examples at places like codeproject.com. But how do you custom draw the scrollbars in controls you do not create yourself? For example a Panel can show scrollbars but how would I ensure that the scrollbars it shows are custom drawn?
Or maybe this is not possible and I would need to create my own version of a Panel so that they use my own custom drawing scrollbars?
The scrollbars you see most often, including those built into most winforms controls, are rendered by Windows and there is no way to override their appearance in WinForms short of implementing an entirely custom solution which completely takes over the rendering and behavior of the common scrollbar control. There are some commercial packagages which claim to do this (google winforms skinning).

Resources