I need examples of WPF controls without XAML [closed] - c#

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I got a good book on WPF but I want some code examples of programming the system without using a alot of XAML markup. In particular I want a rundown of individual text controls and events.
So I want a website or a book, not a snotty comment :P
Please note: stay on the topic! I am not criticizing the system. Thanks.

I'm not really sure what you're asking for because XAML is simply a markup language.
If you take something like
<Button Name="MyButton" Content="Test" />
you're really saying
Button b = new Button();
b.Name = "MyButton";
b.Content = "Test";
I don't think there is any need to create a tutorial on how to make WPF controls through code-behind because the markup language does almost the exact same thing, and in most cases its really easy to convert what you see in the Markup language to code-behind.
And if you really want examples of how to create a specific control through code-behind, you can usually find plenty of code examples via Google.

Glen, unfortunately for you WPF is not built to be used through code. Though you may do some things through code, it's much harder to do so. WPF is built as data based, so to manipulate UI you need to manipulate data, not controls. It's a complicated subject, but lets say that controls may or may not exist in runtime based on their current visibility on screen and other properties.
If you still want to experiment with this you can check out controls in System.Windows.Controls namespace. Once you need to create ControlTemplate or DataTemplate you can use FrameworkElementFactory.
For example of how complicated this can be you can take a look at this question. For that reason, MS suggests that even when you need to manipulate WPF through code, you should place XAML in a string and load it using XamlReader.Load() method (this suggestion is in Remarks section of FrameworkElementFactory documentation).

This is one Where I started With WPFTutorials

If you really want to learn WPF "code-first", there's really just one primary resource out there that I'm aware of:
Sells' & Griffiths' Programming WPF book
They approach WPF from a code-first perspective. I don't think xaml is even introduced until the second half of the (rather large) book.
Note that you'll also be learning to do some things the "old" way, where the newer versions of WPF have learned lessons from Silverlight, etc. (E.g., Triggers vs VisualStateManager)

http://msdn.microsoft.com/en-us/library/ms754130.aspx
as Ed S. suggested, this is the MSDN entry about WPF. On the left, there's a link to controls. Each one control has a link about what they do, what they are for, etc.
I found this WPF/Winform comparison helpful as well:
http://msdn.microsoft.com/en-us/library/ms750559(v=VS.90).aspx

If you want to know something more about WPF, then you can have a look at this blog. You will find a lot of useful informtion about WPF.
Regards
Debasis

Related

Silverlight UI effects [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to build a nice looking UI with Silverlight, something that keep moving in a delicate manner (like this intro)
I know of course this is possible through the Animation features of Silverlight, but they seem to me a bit too exhausting. I'm looking for some ready-to-use UI animation.
As I recall, jquery offers quite a few UI menus (etc.) that are really easy to use.
I've searched quite a bit for effects library, or tutorials, but I couldn't find anything helpful.
Is my only option is writing Storyboard and build my animations from scratch?
Is that considered OK or I'm just reinventing the wheel here for no reason?
Does it make jquery a better choice for fancy UI web applications? (I've never used it , just read about it)
Storyboards and animations aren't that bad to learn. They are daunting at first (because they can be verbose), but if you just take some time to understand them, they are fairly straight forward. You can try some third party control suites like Telerik which have some animation/transition functions but I'd suggest diving in and understanding how they work.
The best way to try to learn the animations is to think of what you want to do first (something simple) and then just research/figure it out. Googles great for this! Do somethign easy at first of course.
View the sample Silverlight animation browser at microsoft to get started... Sample Animations

As a newbie to .NET and C#... WPF or WinForms? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What is the best aproach for developing Windows Applications for a newbie in C# ? WinForms or WPF ?
Wich one would be more powerfull ?
Wich one would be easier and faster to develop with ?
Wich one is easier to port to another Os ?
Most of the "practical" C# books focus on WinForms, are there any begginer's C# book using WPF ?
edit: Edited the question, now it should be constructive.
Please focus on using WPF. You will get introduced to XAML UI programming, which is also the template language for SilverLight and Workflow. You will have a better ROI and it is a more future proof UI technology. The learning curve will be a bit steaper though.
Personally, I would suggest Silverlight if you're just starting out, not Windows Forms or WPF. It's a smaller surface than WPF to start with (and easy to transition "up" to WPF if you need it), but it's also closer to the WinRT API, so it would give you a cleaner future path to more deployment targets.
If your requirement is really the one to port to other OS as well, the mono project:
http://www.mono-project.com/Main_Page claims to have a windows forms 2.0 complete implementation: http://www.mono-project.com/WinForms
if that is more a detail and you don't really care you could try to start with WPF.
my advise would be to focus more on the .NET framework and C# language itself as these are the basis and most of the .NET Framework is available in both so you should know it and get familiar to it, then if your windows derive from a class called Form or another called Window, as long as you know what to put inside and how to approach certain common issues, everything else is a detail (a big detail once you plan to make a huge application of a certain level, bust still a detail).
WinForms seems to be "obsolete" so I think it's better to learn WPF.

Learning WPF without success [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Hello developers and designers,
I am very willing to learn WPF in which i use C# as the logic code.
Or i 'try' to anyway.
I have written a 2-page long code-behind in Forms-style though, so i know some syntaxes.
But that was a really cumbersome way of doing it.
The problem is that i am still lingering around the area of understanding at least the basic concept of object oriented programming. But 9 out of 10 times i am not getting the example-codes entirely because of that '1 little thing of which i don't even know what it's called'.
How do you even know if there is a command for the function you want to express and more importantly.... how it's called and where it located in what namespace?
Even the best video-examples aren't doing it for me, because when any code is typed, they never explain how the code exactly works. And most of the times it just doesn't even add up to what i know of logic code (of course i'm wrong).
In the early days i learned the Commodore64's Basic no problem.
Learning and writing Actionscript (Flash), within 2 months creating a 2D-shoot'em up
Learning and writing CMD, within 3 months writing 5000+ lines of code for all sorts of functions.
Why in Merlin's beard is WPF so hard?
Watching the "simplest" tutorial-video's are becoming more and more de-motivational.
Anyone recognizes this?
Thanks for reading,
Danny
Regarding WPF the articles I've found to be most useful are the overviews on MSDN, they might take quite some time to work through but they are concise and in-depth, see this page for a master-overview.
Why WPF is hard is a good question, one primary cause might be that it is simply huge, at least i perceive it that way. Aside from having all the code you also now have XAML markup which is a world of its own.
Someone from Microsoft who did a presentation on F# in 2008 said that if you know three of the keywords, let, fun & |>, you know the whole language, which is not even that much of an overstatement. WPF on the other hand is not a language, it is a sub-framework. If F# can be likened to 3 nanotechnology building blocks then WPF is a 50 meter workbench stacked with tools (the controls) and a dozen heavy duty machines (WPF mechanisms like dependency properties, data binding, commanding, data templating, etc.), and all of those come with a manual. So if you are facing a problem you pretty much need to know what all the tools and machines do so you know which to use, and then of course you also need to know how to use them, apart from their basic functionality each may even have its own kinks and peculiarities which are important to keep in mind.
So learning WPF requires a lot of raw knowledge of the framework but also experience so you know what is the best approach in a given situation and to get a feeling for what can be done and what cannot.
MVVM: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
Learn it then use it.
I figured I'd add my $.02 since I've recently started using WPF. First off, you'll need to read that MVVM article mentioned by Fëanor, and DEAR GOD, download the sample code and learn what every line in that program does! Reading the article is great, but seeing the code, running it, changing it, etc, is INVALUABLE. I also echo the comments about the MSDN overviews, and the one about creating a side project rather than learning WPF via an existing project.
Other than that, don't expect to get WPF in a day, or even in a week. I've been using it for about a month now, and I've still got a ways to go. I had my "AHA!" moment about a week ago where everything started to click and it became apparent to me what I DIDN'T know which is important. A good strategy would be for you to pick a single concept such as Data Binding, or Data Templates, or Styles, and explore each in depth. It's a lot to chew on, so just remember that Rome wasn't built in a day. And if you're not already comfortable with data binding, I'd pick that up early on since it's pretty crucial.
Lastly, once you learn WPF, it's going to be REALLY hard to go back to using Windows Forms :)
Have Fun!
Q
I don't think that WPF is actually that hard. I think it's just that WPF definitely requires a slightly different way of thinking. You can tell that it was built with certain principles in mind (like MVVM, as another poster mentioned), and it's very different from most other frameworks. If you try to do it like you did Windows Forms or MFC or ASP.NET or whatever... you'll struggle. You need to be willing to change your mind on how things work.
Frankly, I think the only way to learn it is with experimentation. Come up with some side project to work on using WPF and try your hand at it. Learn a bit and refactor it. Get a good book, read the WPF disciples list, read anything that Sacha Barber writes, read the WPF section here on SO.
When you have your first "ah ha!" moment where you decide to write an Attached Property to solve some obscure problem you're having, you'll know you've finally understood it :)

What should a C# developer know before using WPF [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'am more a sysadmin and a webmaster than a developer, but sometime I develop, including C# principally using Winform (and optionally GTK+).
I've started few weeks ago a WPF project, and it seem really powerful, but at start I feel like a hen who found a knife! There is so many difference!
stackoverflow abounds about topic like that, and I've read carefully some who are similar like:
Hidden features of WPF and XAML?
What all should an expert C#/.Net/WPF developer know?
But, when somebody start with WPF from Winform, What are the differences to which he must pay attention?
[EDIT]
What about some advices/links for LINQ with WPF?
What about some advices/links WPF Navigation?
WPF is completely different from other systems.
I have a few years of WinForms, Win32 and web programming experience, and I believe my web programming experience helped the most.
As for books, "Windows Presentation Foundation Unleashed" from Adam Nathan, Sams Publishing has helped me tremendously.
to getting started with WPF a design pattern Model View ViewModel (MVVM) would be important to know.
also I would recommend Adam Nathan WPF4 book. I think it's great one!
Thank you all, but all this is a bit diffuse, so I made a resources compilation and add some things by my own, please tell me what you think (or improve, I make it Community Wiki)
Strangely no one has talked about LINQ which seemed to be a central element of this technology.
Another thing that seems important to know given the time I lost, is not to use the WPF navigation system that doesn't seems to work properly from numerous sources I've read. So, it seem important to use a navigation framework, like Magellan.
And the routed event system seem to be an important point to look at in WPF, if somebody have some interesting resources about it, please add to this post.
RTFM
Windows Presentation Foundation
WPF Documentation Samples
.NET Language-Integrated Query for XML Data
.NET Framework Developer Center - LINQ
Software
In the Box – MVVM Training
Caliburn Micro: A Micro-Framework for WPF, Silverlight and WP7
Blog posts
sachabarber.net
MVVM for Dummies
Deep drive into WPF graphics internals Part 1
Building WPF Applications with the Page Navigation framework
Videos
MVVM Design Pattern NDC2009
The Code Project
Articles by Sacha Barber
WPF: A Beginner's Guide Part 1 of n
WPF: A Beginner's Guide Part 2 of n
WPF: A Beginner's Guide Part 3 of n
WPF: A Beginner's Guide Part 4 of n
WPF: A Beginner's Guide Part 5 of n
WPF: A Beginner's Guide Part 6 of n
Magellan: An MVC-powered Navigation Framework for WPF
Books:
Windows Presentation Foundation Unleashed (WPF)
WPF 4 Unleashed (the same as precedent but for WPF4)
Other Stack Overflow topics
Hidden features of WPF and XAML?
What all should an expert C#/.Net/WPF developer know?
Questions every good .NET developer should be able to answer?
I agree with Arseny, learning MVVM is core to learning WPF properly. It isn't a niche thing - when applied properly it can make your code cleaner, simpler and promotes decoupling and unit testing.
There is a very nice video here which explains both the concept and implementation:
Jonas Follesø explains the MVVM Design Pattern. In the video the guy is talking about Silverlight but the implementation in WPF is pretty much identical.
Once you've watched the video, and you're happy with the basics of WPF you could do alot worse than adopt a framework to take much of the heavy lifting and plumbing off your hands. I highly reccommend Caliburn Micro. This will lead you down the path of best practice by encouraging you to use MVVM but will also take care of much of the coding detail for you. The documentation on the site is a bit thin on the ground but there are a number of tutorials there that are being steadily added to.
For example, when following MVVM you would typcially have a View (e.g. a window) and ViewModel (a C# class). If you had a textbox on the view which contained an order number, you would have a corresponding property on your ViewModel called OrderNumber. Using a WPF Binding expression:
<TextBox x:Name="OrderNumber" Text="{Binding OrderNumber}" />
the textbox would be bound to the property on your ViewModel so that when either the textbox or the property changes, the other automatically updates. Using a framework like Caliburn Micro you don't have to write any binding expressions, it uses a simple convention based approach. In the previous example, if your textbox was called OrderNumber and your ViewModel property was called OrderNumber Caliburn assumes they must be the same thing and automatically binds them for you.
<TextBox x:Name="OrderNumber" />
As above, your XAML becomes much simpler, and leaves you to focus on getting the job done. I wish I'd found a framework like this earlier before I started churning out lots of my own ViewModelBase classes, ViewLocaters etc.
I also suggest Sacha Barber's blog and all its WPF related articles in codeproject. This guy rocks!
The most important thing a Winforms/C# developer should know/accept is that WPF is very different from winforms and Winforms way of doing things is not the correct way of doing things in WPF.
I have seen a lot of WinForms developers using events/delegates and threads to solve every each and every problem instead of using Binding, commands, triggers etc.

Web App - Dashboard Type GUI - Interface [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm looking to create a dashboard type gui for a web application. I'm looking for the user to be able to drag and drop different elements (probably either image buttons, anchor tags, or maybe just divs) to different (defined) places and be able to save their setup (in a cookie or on the server). I'm working with c# in the .Net 2.0 framework. I've tried using mootools but their recent update has left their drag/drop capabilities un-useful for me. I'm looking for a bit of direction because I know there is something out there that is just what I'm looking for so I wont have to build from scratch.
Thanks.
I have been looking at this kind of functionality myself recently and have decided on using jQuery with the help of jQuery UI. I came across a large amount of information that also suggested Yahoo UI (YUI), I had already started learning jQuery due to the AJAX support that it offers, so I stuck with it.
jQuery UI Site
jQuery UI Documentation
Example of a drag and drop screen layout with jQuery UI
Introduction to jQuery UI
If you decide to use the YUI javascript library, here is a link to a vast amount of videos to help get you started.
http://developer.yahoo.com/yui/theater/
If you still want to give MooTools a second chance, I'd recommend taking a look at Mocha UI.
I prefer using jQuery for AJAXy stuff like that. It also has a lot of very good plugins that make writing client-side code very easy.
Here is the plugin page specifically for Drag-n-Drop.
http://plugins.jquery.com/project/Plugins/category/45
Ajax callback are also very easy so saving the setup should be fairly easy as well.
I used the Microsoft ASP.Net Ajax and AjaxControlToolkit to do something like this. They have a ResizeableControl and a DragPanel. I used these, then hosted an IFrame inside the panel to display the content.
Worked pretty well.
This site:
http://www.asp.net/learn/videos/default.aspx?tabid=63#ajax
Has lots of tutorial videos that show you how to get started using the controls.
You might want to look at DropThings on Codeplex.

Categories