I found out how to do it in WPF but how can I achieve this in winforms? The most important thing I want to use is the new calendar control but I would love to have the whole app be Windows 7-like. Sorry if this has been answered already but I didn't find the answer.
There is no native way to do it with WinForms. WPF is a "Exception" as it draws everything itself instead of through the system...
There are though a number of companies that sell themed controls. Such as...
https://www.devexpress.com/Products/Free/NetOffer/
This company also has a lot of controls including a calander:
http://www.bcgsoft.com/
Related
Can both WPF and Windows forms controls be used within one application? How difficult or practical an idea is this?
It is fairly straightforward to host WPF controls in a WinForms app with an ElementHost adapter or WinForms controls in a WPF app with a WindowsFormsHost adapter. There are not too many resources on the web showing how to do either of these, however. In the process of learning how to do this for myself I quickly discovered the inherent symmetries between the two pathways. I distilled all my notes into an article comparing and contrasting these symmetries using a unique approach: the article is really two side-by-side articles, comparing every step in detail, starting from creating a user control in one technology to hosting it in an application in the "opposite" technology. My article, published on SimpleTalk.com in August 2010 is available here: Mixing WPF and WinForms.
For completeness, here are a couple good MSDN references, one for each pathway. In fact, the demo solution accompanying my article started from both of these:
Hosting a Windows Forms Composite Control in WPF
Hosting a WPF Control in Windows Forms
I believe there is a WindowsFormsHost control you can put in your WPF apps which will do interop back to WinForms code:
http://blogs.msdn.com/ivo_manolov/archive/2007/07/26/wpf-win32-interop-part-1-hosting-winforms-controls-in-wpf-windows.aspx
We hosted significantly complex WPF controls in an existing LOB WinForms app. It can be done, but we did have issues (some no doubt caused by the steep learning curve). These primarily had to do with loss-of-focus events not being fired when expected, and also keyboard navigation issues.
You can also use an HWNDSource and HWNDHost controls to embed WPF controls in a WinForms (or any Win32, really) app.
When hosting non-WPF content (Be it HTML, WinForms, or Win32 content), you will haveAirspace issues. This means you can't completely compost the WPF content with the hosted content. You also can't animate it etc. There are some interesting issues with respect to scrollviewers see here for more details and a fix also.
Yes you can, both Windows Forms within a WPF application, and WPF controls within Windows Forms. www.novamind.com's mind-mapping application is a successful mix of the two technologies.
With Windows 8 and Windows 10 out, the original set of WPF controls is beginning to look a little... dated. I'm looking for something else, something that fits a little better in the more modern UI designs.
I've looked at mahapps.metro and Modern UI, and those seem a little drastic to me. The TabControl is a perfect example -- I'm not fond of the unbounded blocks of text that both of those seem to use for tabs. I prefer a bounded box. On the other hand, in Windows 10 the default focused WPF window has a white background, while the unaltered WPF menu is has a gray background, which looks a little weird:
Does anyone know of any good toolkits for pre-styled WPF controls aside from the two I mentioned earlier? Or am I more likely to get what I'm looking for by mixing and matching -- a little mahapps.metro, a little default WPF, a little custom styling?
I'm not looking to reinvent the wheel here. I don't want to find myself endlessly writing new styles, templates, etc, and micromanaging the XAML. There's a lot of interesting code in my project, and writing hundreds of lines of XAML is not my idea of a good time. :)
If it matters (I don't think it will, but you never know), I'm using Caliburn.Micro for my MVVM framework.
Or am I more likely to get what I'm looking for by mixing and matching -- a little mahapps.metro, a little default WPF, a little custom styling?
Yes, probably. You won't likely find a toolkit that just make all built-in controls look exactly like you want :).
Another option may to be look into the Universal Windows Platform (UWP): https://learn.microsoft.com/en-us/windows/uwp/get-started/whats-a-uwp.
These are the new kind of apps that can run on any Windows 10 device including PC, tablet, phone, Xbox, HoloLens, Surface Hub and more. The controls have better support for touch and pen input and probably look more what you refer to as "modern".
WPF is still a great choice for developing traditional Windows desktop applications. And if you compare the look of the built-in controls to a classic desktop application like Visual Studio, they don't look that "out-dated". Different kind of applications serve different kind of needs and sometimes you want controls that are tailored for a user that always uses a keyboard and a mouse and sometimes you don't.
I am working on a Metro app, and as far as I know there is no datepicker control available ATM. In my app the user is working with dates, and I am looking for a way to make this less painfull for the user.
What would be the best way to go about it? Anybody have a nice custom control sample they would like to share?
I have the same problem with graphs, but I am hoping to get an access code to Teleriks preview to their Win8 controls, but I couldnt see any date or timepickers there.
Currently there is not a WinRT DatePicker as explained in this MSDN answer. Tim Heuer and some are working on some simple WinRT components. You can find their work, called Callisto, on Github. A DatePicker looks to be next on the list, but they could always use help as well. The best place to start would be the Windows Phone 7 DatePicker. You can download the source from Codeplex.
Telerik has now released the beta of their windows 8 controls, one of them being a datepicker! Problem solved :)
I want to write a desktop gadget that will group icons on my desktop (using c# & WPF).
It will be a docked window that I can drag icons to it and they will stay their. Also there can be couple of this windows.
Where do I begin?
**I saw all the post here about it but I got lost. Please direct me to examples and explanation pages.
To expand on cevik's answer:
You cannot create WPF applications as gadgets BUT you have two options (which aren't as bad as you'd expect).
The reason is that widgets are composed mainly of web pages (HTML) and not executable (*.exe).
The problem of course is that WPF will only work with & produce executables.
First option - Windows API:
When I said you can't what I really meant is you can't use the Windows Vista/7 gadget platform to make your widgets.
However, you can always achieve a similar effect by using the Windows API.
The Windows API will let you do stuff to windows such as making them always on the background of other programs, which sounds to me like ~80% there (The rest would be stuff like making sure your window doesn't get re-sized or minimized, etc.).
Just as a note, the function you'd be looking for to make the window behind all other windows would be SetWindowPos (specifically the second parameter).
However make sure there isn't a library which already implements these stuff because it can be rather difficult (and consist of A LOT of surprises).
Second option - Silverlight
silverlight can be perceived as WPF for the web.
That obviously solves our problem.
However there is a cost to it, as expected.
Silverlight doesn't have all the features WPF has (possibly not all of the .NET framework as-well, not sure about that as I'm not really using it).
However it should be more than enough to get you by so you should definitely check it out.
Once you have your Silverlight application (and webpage) you'll have to create a manifest & install the gadget to your desktop. See here how to do so.
Maybe this will help you.
Template to easily get started on developing a Sideber Gadget using Silverlight 3.0 or 4.0 controls in C#.
I was just wondering if there are ways of creating my own custom winforms controls?
I've been plundering with Visual Studio 2008 now trying to do some c# apps. And the GUI end up looking terrible because of the standard winforms limitations.
And I noticed that I can add images to buttons for example, but ther's no hover effect. Or, the hover effect makes the whole button area gray. I don't want any of that, I just want to either create my own graphics for the controls or find some free (opensource perhaps) controls that already exist.
Any light on any of this, anyone? :)
You can write complete Winforms controls from scratch, doing all the painting and input processing yourself - you just create a class derived from 'Control' and get on with it.
There's a fair bit to making a first-class control which integrates nicely with the VS designer, so people tend to derive their custom control from an existing control which has most of the behaviour they want.
Here would be a good place to start: http://msdn.microsoft.com/en-us/library/6hws6h2t.aspx
I'm puzzled, you are doing WinForms development, yet in comments say you have done many months of WPF development, but WPF is not good enough because it is not cross platform.
How is WinForm more cross platform, and have you seen how ugly WinForms looks under mono on a Mac as it's draw via X11.
If you want style and cross platform, go for Flex or Silverlight, as your already know WPF I'd go the Silverlight route.
It's cross platform, and has all the beauty of WPF, but at the cost of reduced functionality out of the box.
First - may be more pragmatic to look at WPF, or hosting some WPF elements inside winforms (which is supported - like so). Other than that - you can do all your own painting if you want; but it is a lot of work.
Any reason why you don't use WPF? You have much more more UI control if you went down the route.
If you must go with WinForms then there are many commercial solutions like DevExpress. If you really want you own look and feel it'll be alot of work.
Yes. You can create your own controls. It is called a User Control. Just select Add->and User Control.
WPF is a good alternative if you want your windows form to look fancy.