none
Moving from VB.NET winforms to C# WPF RRS feed

  • General discussion

  • Hi,

      I currently use vb.net with winforms, and I want to learn both WPF and C#. Which is better to learn first and why?

    Monday, November 30, 2015 7:14 PM

All replies

  • WPF is different from winforms, in a number of ways.

    One big way is that it uses XAML markup for the UI.

    To write a wpf application I write xaml for the ui ( and perhaps a little code ) and I write c# for the rest.

    You could learn a bit of xaml and then c# or more c# and then xaml but really you'll find you learn a little c# and a little xaml and that's enough to get you by at first.

    You will then be on a learning curve with both.

    By the way.

    I have done something similar myself. I used to do asp.net, winforms and vb. Transferred to c# and learnt wpf. I didn't realistically have the chance of learning wpf when I learnt c# though.

    It took me a week to get reasonably confident with c#.

    Once you get past re-arranging the way you declare your variables, sticking a ; and curly brackets all over the show... Oh... and remembering = sets and == compares.... then it's all downhill.

    Well.

    Aside from when you start looking at hard code but then the language is irrelevant anyhow if someone wrote something in an obscure "clever" manner or is doing something really really hard.

    .

    Take a look at my first two mvvm articles/samples linked in my sig and this:

    http://social.technet.microsoft.com/wiki/contents/articles/32610.wpf-layout-lab.aspx?Sort=MostRecent&PageIndex=1

    See what you make of em. 


    Hope that helps.

    Technet articles: WPF: MVVM Step 1; All my Technet Articles

    Monday, November 30, 2015 7:26 PM
    Moderator
  • There is no real need to learn C# before you learn WPF. You could use VB.NET as your development language when developing WPF applications the same way you do when developing Windows Forms applications.

    So in order to move from Windows Forms to WPF there is no need learn a new programming language first.

    If you however do decide to change your primary programming language and use it when developing your new WPF application(s), I would recommend you to learn it before you learn WPF. Every successful WPF developer needs to know how to write code. But as far as the XAML markup is concerned, there is no difference between choosing C# or VB.NET as your programming language.


    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Tuesday, December 1, 2015 6:31 PM
  • I think it will be a plus to work in a different language because anyone new to wpf will want to learn MVVM as well.

    It's very different and the switch from vb to c# is a good thing because you're immediately thinking in different terms.

    That makes it easier to adapt to the rather different way of working which is inherent to MVVM.

    And you can't just cut and paste code out of old apps so you won't be tempted to paste winforms code in.

    If you did then anything to do with UI is likely discover different and winforms code is a dead end.

    Switching language is a plus because it's constantly reminding you that you're doing something different.

    In any case, the vast majority of teams use c# now. Few employers ( in the UK at least ) want VB.

    Since most devs use c#, most blogs and samples you can find use c#.

    This is quite a big factor in learning/working with any new technology.


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Tuesday, December 1, 2015 7:39 PM
    Moderator
  • Thanks to everyone who responded. The general consensus seem to be C# first, then WPF. Thanks for the advice!
    Saturday, December 12, 2015 5:33 PM