How to apply Windows Forms Control to WPF Custom Control Library? - c#

I'm trying to encapsulate Windows Forms Control (from previous version of project) to WPF Custom Control Library. Because I want to use it in future Wpf applications (like drag&drop from toolbox in VS). I successfully done this: WinForms in Wpf App. Do you know site/or tutorials where this things are explained?
What I got: .dll with WinForms control, Wpf Custom Control Library project (to place WinForms control) and Wpf Aplication.
Thanks for your help and suggestions.

What SonerGönül is refering to, is that if you read the links he points out.
You can see you should have done this steps better:
Do your homework
There is plenty of examples all over on how to achieve what you want to do.
Search on Google something like "how to host winforms in wpf"
You will get plenty of links like:
http://msdn.microsoft.com/en-us/library/ms751761.aspx
Even questions done in this site in the past.
Be specific, Make it relevant to others
You need to make a more clear question. Read your question as if someone else is the person who wrote it, and think if you would be able to understand it properly.
People in this site wants to see you have worked towards solving your problem, therefore you can mention things you already have done, and make a specific question.
Like "I implemented what this website suggest but I am getting this exception"
To answer your question
I really like this website: Mixing WPF and WinForms
Because it gives you a nice both side explanation of how Mixing WPF and Winforms works, with examples.

Related

how to create a flyout panel in WPF

As the question suggests, I'd like to know if it's possible to add a flyout panel to a regular wpf application, specifically to a UserControl. From the results I've got from googling, most available flyouts seem to come packaged with a template of some sort without explaining how they're made.
The closest I've got is the Extended WPF Toolkit but even that has no documentation on how to use it. As it is I'm currently trying to keep to the MVVM pattern. So is there anyone with an idea of how to make one?
You can add flyouts using mahapps.metro, which is free and opensource.

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.

show timeslice with timeline in c#

I want to implement sjf (Scheduling) with c# and I need timeline for show how it workes. For example in this timeslice that process do its job. I want to show it graphically.
How I can do that?
Something like this :
i can implement, i just dont know how to show it graphically like that.it is windows form app in c#
To graphically display a schedule as you describe, using WinForms / C#, consider using a Gannt chart control.
Don't try building the control yourself, there are good off-the-shelf controls that are robust, low priced, well supported and have loads of sample code.
Telerik for example: http://www.telerik.com/products/winforms/chart.aspx
I mentioned Telerik as I've used their WinForms, WPF and ASP.Net controls before, they have plenty of different snippets of sample code, so it's easy to test out and they are well maintained with regular updates. Get a trial copy, see how it works for you and then go from there.
There are many others sources of Gannt controls, see previous StackOverflow topic: Gantt Chart Controls on Windows Forms

How to use C# with WPF

I want to create a UI for my application.
What really confuses me is how to actually do it. I know that Microsoft has introduced WPF.
I have also seen some examples, but what I am not getting is whether or not WPF a seperate language? How can I use C# with WPF?
Lets say I want the user to click on a browse button, select a file and display it's content on the UI. I want to do it using C# while WPF providing the UI, is this possible?
Any good resources for a newbie like me?
EDIT
What i didnt understand, will i use WPF for my UI or windows form for my UI while my actual code is in C# ?
I think i am being lost here ? WPF seems something else that supports c#. is that true ? i thought WPF was only for UI while the actual code would be in C# or VB.
I have taken wpf unleashed but it explains wPF and not how to use C# with it. Atleast in the starting chapters ?
I know i am being dumb here but i am really confused
Yes it is definitely possible. Take a look at this article about Mode-View-ViewModel (MVVM) from Microsoft, which is a good introduction to using Xaml (the markup language for WPF) with C#.
Since you are familar with WinForms I will explain it like this.
WinForms provides the GUI and it is similar to what WPF does.
WPF however mainly uses XAML, a markup language based on xml to design the visual elements. It is a presentation foundation on its own that could be used without XAML but it is certainly a big part of it.
When creating an application it will be either WPF or WinForms you can't combine the two (well easily anyway I know there are a few ways to get around it)
You can interact with WPF the same way you interact with WinForms elements.
You can create a Window. On there you can place a grid, where you can then place controls such as a button or textbox. Then in the code behind it is exactly the same as referencing a control in winforms. for example in the page_load function doing
txtInput.Text = "A String";
So what should you choose? (Please note I am about to give you a few things to compare I realize this hardly describes both technologies to its fullest)
WPF
Pros
- Great for visually appealing designs
- You have XAML based control over your visual elements. Meaning you can change the way your form looks by writing xaml instead of doing all through the visual studio IDE pressing buttons.
Cons
- Bit of a performance hog. It has come along way with .net 3.5 sp1 but still chews up quite a few resources
- Not as many controls built for it as WinForms, mainly because its a newer technology.
- Can become complex as syntax for binding information to controls doesn't include intellisense.
WinForms
Pros
- Familiar and well used technology so your development will be faster
- Better performance
- More controls built for it
Cons
- More effort to build a visually appealing design
- Its not new and exciting so to speak. I know we all like to learn new things :)
It is not a seperate language. WPF employs XAML, a derivative of XML, to define and link various UI elements. As in web development, both layouts and specific themes are well suited to markup, but XAML is not required for either. Indeed, all elements of WPF may be coded in a .NET language (C#, VB.NET). The XAML code can ultimately be compiled into a managed assembly in the same way all .NET languages are.
You can implement your requirement in easily WPF.
To get a hands-on in WPF start with this article, http://10rem.net/blog/2010/02/09/getting-started-with-wpf--hello-world-in-multiple-flavors
Happy coding..
WPF is part of .NET framework, so it's not related with specific programming language. Please read MSDN's "Introduction to WPF" - http://msdn.microsoft.com/en-us/library/aa970268.aspx

how to design a calendar control

I need to design a calendar control which should be added to our companie's application (I know there's already quite a lot calendar controls but I shall develop our own one...).
How should I start, should I use a kind of table to display the days or should I completely draw my own grid? How can I do this (I do not need rdy-to-use code, I just need some ideas...)
The application is written in C# as a WindowsForms application (thanks for the hint, forgot to mention this in first case...)
Seeing your comment about WinForms and:
I need to develop an own one because it must be integrated in an already existent application, I need full access in means of style and functionality
makes me suggest to use ready project http://www.codeproject.com/KB/selection/MonthCalendar.aspx and modify it if necessary. I use it in my own little project and it works like a charm. It provides full source if necessary so you can integrate it easily and modify if you think it's not fit enough.
In the end if you end up not using it, you can peak at the sources and functionality it implements and do it your own way.
To me redoing it from scratch is a bit pointless especially with such a good / free one.
If you are developing a web application then I would seriously look at using jquery. A good calendar control should be done client side so I would be looking at some form of java script solution. If you look at jquery-calendar.js as a good example you will see the complexity involved in developing your own control.

Categories

Resources