How To Create Reusable Window Template/Model - WPF - c#

Ok, I'll try to explain what I want to accomplish:
I'm quite new to WPF and XAML and I would like to create some domestic use applications with custom reusable UI. To be clear, I would like that every Window uses the same "Appearence" (specially the non-client area) without customizing every single one of them.
I've done some researches (obviously) and I found something that resembles perfectly what I'm trying to do: MahApps.Metro Template.
But I don't want to use some third party code because I like to have control all over my application and I want to customize what I want by myself. So I'd like to know what is the correct (and the best, maybe) way to do so. I've read plenty of posts about Window customizing but I didn't find anything that explained how to do that in that way.
I hope to have well-explained myself and I thank you all in advance for the help!

If you want to make custom UI in XAML you should learn to use Expression Blend. Here is a resource you can try -
Inspirational Textbox Styles (Source code available)
There are several videos available on youtube on Expression Blend for making custom UI in XAML. You can try that.

Related

Use datatemplate without listview

I would like to know if it's possible to use a data template and a list system without the listview controller on xamarin forms.
You can definitely roll your own controls that use the templating engine. It would just take a whole lot of additional work with custom renderers for each platform etc. If you want to look into that you can check out the source code for Xamarin Forms since it's open source to see how they implemented the ListView. I think the negative voting is because this is quite a broad question that doesn't have an easy answer.

Any .NET Winforms control which look like this QT's QPushButton?

Is someone know any .NET Winform control which look like this button control?
QPushButton:
http://zetcode.com/gui/csharpqyoto/layoutmanagement/
You have several options here. You aren't specific about exactly which part of the platform you are using, but if using Winforms, you can certainly customize the buttons to some extent.
If you are using WPF, you can pretty much make it look exactly like you want in XAML. Check out Expression Blend.
As #Dimitri put it, the sky is the limit, but you may need to do the leg work.
You can create custom controls according your need and have its reference added to your project. you will have it added to your toolbox that you can use.
If you are refering to a button that is located on this example form:
We currently finishing our own application that has rather similar looking buttons. We did this by using a third party component. Steps are:
We purchased DevExpress.com's WinForms library.
We developed our own DevExpress Skin (with the help of an external screen design guy)
This was a bit of a work and some amount of money but the results look pretty neat.

How can I create/skin a C# UI?

Ive been working on a C# project for a while now and I fell it needs change its look.
I have found a UI kit that I really like, which can be seen below:
http://medialoot.com/item/transparent-ui-kit/
Does anyone know how to do this?
Thanks
EDIT: Im using WinForms
EDIT2: Maybe I should convert over to WPF? Is this doable?
You can subclass most common controls and draw their appearance yourself. However, unless for novelty applications I doubt your users will thank you for doing so.
Your example is a library of controls. For you to have an appearance such as that you'll have to create or acquire a similar library of controls and replace all your controls in your project to get that appearance.
If you want to update colors (background, foreground, etc.) and such you can make a class that recurses through controls and sets the settings using reflection and a switch statement to process each control. Then just run this on each form before you show it. One word of caution about this, some controls don't respect your changes and get overridden with themes from the OS (datetimerpicker being the biggest culprit). You'll also need to consider whether your users will appreciate the extra work put in for color/appearance changes.
If you don't have very good design skill and have a good know how about creating such templates, its better to buy them.
And C# is just a language. You're looking to create templates and skins for either for ASP.NET website/application or for windows forms.
Have a look at DevExpress Skins
If you can afford it.

How to accomplish different states of view in WPF Apps

I have an idea for a personal project. And I know one way of accomplishing it in Windows Forms (which I no longer wish to use). Basically I could (in WinForms) just draw everything onto the screen (Form) and then when I need to switch views/states of the application, just redraw the new stuff in the old stuff's place.
But how can we have different states in WPF? Is there a "right" or "proper" way of doing this? Is something like this covered somewhere in the docs?
I'd like to do my own searching, but I have no idea what exactly to look for, and current attempts at finding the right information, so far have yielded no helpful (or even relevant) results.
Any help at all will be greatly appreciated. I am new to WPF, but have been making a lot of progress this past week!
Thank you!
P.S.:
I just thouhght of something. If the solution was to draw what is needed for one screen, and when it is time to display the next screen, just dispose of/hide everything and create/display the new stuff, then how would we get around this? Because we can't/shouldn't change XAML markup at runtime, can/should we? :/
Not sure how you drawn your views/states in WinForms (direct painting on a Graphics object?).
The closest to what you're describing is the VisualStateManager. You can use it to statically define several visual states inside a single XAML and transit between them (using a smooth animation if you want).
If what you've done was show different Forms with Show/ShowDialog(), then the equivalent would be to use different Windows and Show/Hide them.
If you just cleared/added Controls to your form, then you can do just the same in WPF. Most Controls in WPF have a Content or Children property instead of Control.Controls in Forms.
I don't know if I understand what you really want. But here are my thoughts:
You can use several Windows and Show/Hide them accordingly
You can use the Frame/Page functionality in WP (MSDN)
if you really need to you could load your XAML and remove the topmost content in your Window and replace it with the loaded content
You could use the VisualStateGroup functionality to change the appearance of your current window
I think you will be happy with the second solution

Creating custom forms in WPF?

I'm currently learning WPF. I really am enjoying it so far. I love how easy it is to make great looking apps, and would like to create an app that has a custom window border. I would like for it to look something like this:
I know I could just easily change the Window type to not have a boarder and go from there, but that seems to much like WinForms. Wouldn't it be better to just create a class that derived from Window and styled it? If so how can I do this? Thanks!
Here's a great article on customizing Window "chrome" with WPF:
Custom Window Chrome in WPF
It is accompanied by a Code Gallery project from which you can download the code:
WPF Chrome
To show non-standard borders you have to set AllowsTransparency=True and no Border from the window. Whether you want to do this in the class is up to you. You basically have to realize WPF is really just a DirectX application hosted in a standard window. So you if you want non-standard Windows behavior, you have to drop the standard window border and start re-wiring it based on the standard window events you want to handle. Dragging, minimize/maximize/restore, Title bar.
Really, it shouldn't take you more than 30 minutes to an hour to come up with something close to what you want, and you could certainly put your custom window in a base class for re-use on down the road.
I have a feeling, for most cases, this is going to be the better and quicker option than trying override default Windows drawing.
There is a product called "Blendables" which contains a ChromelessWindow control in their "Essentials Mix" bundle which makes this very easy to do. I've never actually used it myself, I just know it exists and thought it might be of use. At bare minimum it shows that you can do what you ask about creating reusable, templatable chrome.

Categories

Resources