Is there an owner-draw control for silverlight, wpf - c#

Sorry for the dumb question but I'd like to know if an ownerdrawn control can be used in a WPF or silverlight application. I never heard of one though,
Thank you,.....

Actually the beauty of WPF is that every control is actually ownerdraw (in terms of Windows Forms development). You can do with the shape of controls whatever you want still remaining consistent in all functinality provided by him.
It's impossible in one answer to describe all potential WPF has, so I strongly suggest to find WPF documentation and read read read...

Related

Create an editable table using WPF controls

Maybe this is not the right forum for my question, but I'll try anyway.
I am creating an application where I want the user to be able to fill in values in a table/matrix. The values are then going to be saved to a database I have set up. I want to build this application using Windows Presentation Foundation (WPF). I watched the following video on youtube:
https://www.youtube.com/watch?v=_i4mYXSaD4w and it shows very well what features I want my own application to have. The problem is, the example in the video is made in Winforms...
So, my question, which can be split into three parts, is:
Is there a way to build something equal, similar or better, in WPF?
What/which control(s) should I use? Grid? DataGrid?
How do I use this control?
I am new to WPF, and do not have a good picture of what controls to use. I have read many questions about WPF's DataGrid on StackOverflow as well as other QnA's, but I couldn't understand how to do what I wanted, or even if it was possible. Therefore, I'm very thankful to anyone who can explain and lead me onto the right track.
I suggest you to read this article: http://www.codeproject.com/Articles/30905/WPF-DataGrid-Practical-Examples

Transitioning from Windows Forms to WPF

For a long time now, I have been stuck with Windows Forms development (started with VB6, and has continued through to C# .NET 4.5), and I have pretty much hit the limit of what Windows Forms can do, both using pure .NET, and special effects with Native Code.
I have tried to learn WPF and XAML, but I get stuck right at WPF's new designer. It really seems very difficult to use in comparison to the Windows Forms designer.
I want to know if there are any alternatives to .NET's WPF designer, that are more suited to Windows Forms developers?
I like to blog about beginner articles for WPF, and there are a few in particular that may help you out:
Understanding the change in mindset when switching from WinForms to WPF
What is this "DataContext" you speak of?
A Simple MVVM Example
To summarize, the biggest difference between Winforms and WPF is that in WPF your data layer (the DataContext) is your application, while in Winforms your UI layer is your application.
To look at it another way, with WPF your application consists of the objects you create, and you use Templates and other UI objects to tell WPF how to draw your application components.
That's the opposite of WinForms where you build your application out of UI objects, and then supply them with the data needed.
Because of this, the designer isn't actually used that much since your application components are designed in code, and the designer is only needed to draw a user-friendly interface that reflects your data classes (typically Models and ViewModels)
And personally, I prefer to type all my XAML out by hand since it's faster and doesn't make as much of a mess as the drag/drop WPF designer does, although I do use the Designer on occasion to preview what my UI will look like.
So to your answer your question about if there's other WPF designers suited for WinForms developers, I would suggest that instead of looking for another designer, instead look to learn how to use WPF in the way it's meant to be used. Using WPF like it's WinForms means you miss out on much of what makes it so great :)
Well although, some people don't agree, I would also recomment to not use the VS designer. At least not to create an interface. If you may want to get a first impression of your implementation without starting the application, it's a good viewer at least as long no sophisticated things like Styles and Templates are used. But, IMHO, its drag and drop result should only be used as prototype and therefore be discarded after it's no longer needed.
Here are some reasons which are important for me not to use it.
The VS designer is working with fix margins and alignments (which is usually not necessary, if you're using the layout controls), means you have to touch many controls, if the requirements are changed. If you're deep in XAML and the WPF mechanics you can create an applications which can be modified with small effort, regarding the look and feel.
Since the designer is generating the xaml, the composition is not optimal and the UI may perform badly. I didn't measure it, it's just a feeling.
A much better alternative is MS Blend, although the start is everything else but easy. Its drag and drop result is much better that the result of the VS designer.
But it's a pretty powerful tool, which helps you to use pretty powerful elements to create a state of the art UI. I recommend to visit at least a short workshop to get an idea of its opportunities.
Back to your question, IMHO, and I think many people agree, get yourself a good book e.g. WPF Unleashed and later, if you want to know more about the details, WPF Pro. There are a lot of features which are different to Winforms. You won't get to know them by using any designer. I think that's the best approach.
Please also consider that there are many frameworks and libraries (e.g. MVVM light, WPFToolkit) out there, which are already solving some common problems. So it's not necessary to reinvent the wheel.
I know this is an old question but for the benefit of anyone else looking at this, I think I should redress the balance a bit - reading some of the other answers, I get the feeling that some of the 'don't use the designer' sentiment comes from not using it properly.
This tutorial is quite good to get you going and answers some of the criticisms in the other posts.
For instance, you can switch from the Winforms-like margin-based layout that is the default when you drop a control, to a more WPF-ish style by right-clicking and selecting 'Reset Layout'
This video covers similar ground.
I still prefer the VS2010 designer on balance - VS2013 seems to be a bit buggy when dragging and dropping onto TabItems **, (which my current project uses a lot) - but the VS2013 Document Outline view lets you move things around in that view too, which can be a real plus.
Really, though, to get the most out of WPF and xaml you need to be reasonably fluent in both the designer view and the xaml view and switching between them; if you shy away from the designer, you are missing out on something that can help you a lot.
** Edit - although this seems to have been improved in Update 3 for VS 2013, and in previews of VS14, to date I still get odd behaviour at times.
First of all, in WPF (XAML) in Visual Studio deisgner, you should always use the xaml code to build you UI and do not drag and drop you control! You need to keep your code clean. You can use Expression Blend to help you, it's more graphic oriented with drag and drop, but it's not free.
It's not a big learning curve, but I think you should learn how to do your xaml by hand instead of searching for alternative.
I've been through this process as you did. Afterwards I was teaching everyone in my company WPF. There are a couple of important lessons I have learned and everybody I know who works with WPF.
If you are working with UI controls in the code behind, .... Then you are doing it wrong. There is absolutely no need for you to deal with UI controls in the code behind.
You do not need the visual developer for clicking on it. You are much more productive by only dealing with XAML.
Use Copy/Paste. Do not trust in your typing capabilities. It will save a lot of headaches.
Think of the XAML just as a window that loks over the data. In the code behind you are changing the data. In XAML you are defining how the UI will interpret the data.
Converters are amazing. As soon as you get a key amount of Converters, your productivity will rocket Sky high. They will take over the role of the crazy amount of control eventhandlers that hide or resize, or what ever about UI,
It makes UI development fun. Especially once you find out how it likes to play along with Asyc processes. It really takes away a lot of the headaches that were caused by Winforms.

Non-standard UI in C#

I'm still learning C#, and I know don't know about WinForms yet but I will very soon. However I want to know how I would create an application which shows a customized notifier, like Growl on a Mac. Here's a mock up:
http://img25.imageshack.us/img25/3793/41151387.jpg http://img25.imageshack.us/img25/3793/41151387.jpg
Could anyone point me in the right direction? And I know I should learn more about C# before trying this, but I've always liked to peek on complicated stuff.
Take a look at this third-party WPF NotifyIcon control, I think it does what you want out of the box, hopefully something like this will be part of WPF in the future. I have used this one before for the exact same reason, and it is really good: you can use standard tooltips or "toast" popups, or create your own which could be just like the one in the example you posted if you wanted.
WPF would be a great place to start. you can make UIs in pure XAML without even touching C#
Here is an example of an "notification" implementation using WPF
Here are some reference links:
http://en.wikipedia.org/wiki/Windows_Presentation_Foundation
http://windowsclient.net/wpf/
You should probably look into WPF (Windows Presentation Foundation) to design some of the nonstandard UI stuff.
However, I would recommend becoming familiar with UI design in general before diving into nonstandard stuff.
Since you are starting from scratch, I would consider learning WPF rather than Winforms.
Here are two examples are a pop-up notifier in WPF:
WPF Taskbar Notifier - A WPF Taskbar Notification Window
PopUp window on a specific time in WPF?
WPF is Definitely what you are looking for if you want something like the image you provided. My project uses notification popups similar to that in the screenshot. Its really simple to get the wanted results after looking at a few samples of others who have done it. If you would like some help, you can send a message my way.

C# + Custom graphics on controls?

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.

How to move from WinForms to WPF

I used WPF very little before and some stuff seemed very different to achieve. Coming from a winforms background, what things will seem different and take you a while to figure out.
Off top of my head, I remember not being able to specify which nodes are selected in a treeview control the way it's done in winforms, if I am not wrong.
I remember the whole MVVM principle..
But its okay now.. we are bffs now! :)
Oh, where to begin? WPF and WinForms seem very different to me. The concept of defining layouts using markup is quite different, although similar to web development. The fact that you need to make an explicit choice of a layout container (for multiple elements) is novel. I remember trying to add a bunch of elements directly within a Window and getting very confused...
I think to take advantage of all that WPF has to offer, you need to have a WPF mindset. For example, you don't have to use styles, templates, and bindings, but those concepts are where the power of WPF lies.
As Daniel stated WPF is different and it needs a different Mindset. You have to forget all the UI side assumptions you made/learned while doing Winforms or other conventional UI side development
I have comeacross so many similar kind of questions in this site. Some interesting once are listed bellow. You can find many here.
What are the most common mistakes
made in WPF development?
How to begin WPF development?
When is Winforms the correct choice vs. WPF?
For your selected node in a treeview the ModelView ViewModel approach works well. People have worked out good design patterns now for this kind of thing making the process much more easy.

Categories