Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Finally started doing some WPF...

Finally started doing some WPF...

Scheduled Pinned Locked Moved The Lounge
csharpquestionlearningwpfwinforms
57 Posts 26 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pete OHanlon

    If you have any ASP.NET in your background, this[^] might help a little bit to get you in the right mindset.

    Forgive your enemies - it messes with their heads

    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #14

    ASP.NET (or web development in general) is the other thing I should start with sometime... :^)

    It's an OO world.

    1 Reply Last reply
    0
    • V Vark111

      Databinding, databinding, databinding. Databind everything. Databind your controls. Databind your labels. Databind your error messages. Databind your buttons. If you set a property on a control without databinding (or XAML), then that's a smell that you might be doing it wrong.

      Sander RosselS Offline
      Sander RosselS Offline
      Sander Rossel
      wrote on last edited by
      #15

      Thanks. I'll keep that in mind! :)

      It's an OO world.

      W 1 Reply Last reply
      0
      • D DaveAuld

        May the force be with you... Everytime I go near WPF, I last about 30 minutes and say **** this! Maybe one day I will get past the hour mark (are there blue pills for WPF?). Hopefully, it will not end in :(( (well there might be a few to start with :sigh: )

        Dave Find Me On: Web|Facebook|Twitter|LinkedIn


        Folding Stats: Team CodeProject

        Sander RosselS Offline
        Sander RosselS Offline
        Sander Rossel
        wrote on last edited by
        #16

        It can't be THAT bad... Right? :confused: Well, I'm still young and flexible so perhaps I can just sort of roll into it... Maybe ;p

        It's an OO world.

        realJSOPR 1 Reply Last reply
        0
        • P Pete OHanlon

          If you have any ASP.NET in your background, this[^] might help a little bit to get you in the right mindset.

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

          R Offline
          R Offline
          Rage
          wrote on last edited by
          #17

          Great author ;) And don't miss the suggested reading tips at the end of the article as well, if I may add.

          1 Reply Last reply
          0
          • A Abhinav S

            Naerling wrote:

            Any tips for a WinForms going WPF programmer? (and no, I don't find this a programming question)

            1. Do not, I repeat do not, go for the event programming model of Windows Form. 2) Always try and think about 'binding' properties.

            Too much of heaven can bring you underground Heaven can always turn around Too much of heaven, our life is all hell bound Heaven, the kill that makes no sound

            Sander RosselS Offline
            Sander RosselS Offline
            Sander Rossel
            wrote on last edited by
            #18

            Abhinav S wrote:

            1. Do not, I repeat do not, go for the event programming model of Windows Form.

            I got that from the book... The Events model is quite a drag to master it seems :doh: Especially as VB programmer I am used to the Handles keyword at the end of a Method... Luckily I've done some C# too, to get a feeling with some non-VB approaches :)

            Abhinav S wrote:

            1. Always try and think about 'binding' properties.

            I will!

            It's an OO world.

            1 Reply Last reply
            0
            • L Lost User

              Ian Shlasko wrote:

              The code-behind is the glue that links the GUI to the model... Ideally, that's ALL it does... Realistically, the lines tend to blur a little with more complex applications.

              Espeacially when using things like infragistics[^]. [EDIT] Correct spelling of Infragistics... I wonder if that is what got me the 1 :((

              Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

              modified on Tuesday, August 30, 2011 10:14 AM

              R Offline
              R Offline
              Rage
              wrote on last edited by
              #19

              Collin Jasnoch wrote:

              infagistics[^].

              I love your (subtlety ? lapsus ?) contraction: infamous U infragistics = infagistics.

              L 1 Reply Last reply
              0
              • I Ian Shlasko

                Naerling wrote:

                Any tips for a WinForms going WPF programmer?

                1. Forget everything you know about interfaces and design tiers. WPF is a completely different paradigm. 2) Learn to love XAML. It's weird and awkward at first, but once you get used to it, it's magic. 3) In a perfect world, your code-behind should NEVER* have to refer to a GUI control. Don't even assign names to your controls unless you need to refer to them from a trigger or storyboard. * There are, of course, unavoidable exceptions to this... Try to minimize them.

                Proud to have finally moved to the A-Ark. Which one are you in?
                Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #20

                Ian Shlasko wrote:

                Learn to love XAML. It's weird and awkward at first

                That's an understatement! ;p But I'm managing :)

                Ian Shlasko wrote:

                In a perfect world, your code-behind should NEVER* have to refer to a GUI control.

                I like knowing what it would be like in a perfect world. If I know how and try to write perfect code at least I don't end up with completely horrible code ;p Thanks for the tips!

                It's an OO world.

                1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  Thanks. I'll keep that in mind! :)

                  It's an OO world.

                  W Offline
                  W Offline
                  Wayne Gaylard
                  wrote on last edited by
                  #21

                  Just remember Binding(in case you forgot) :laugh:

                  Live for today. Plan for tomorrow. Party tonight!

                  1 Reply Last reply
                  0
                  • Sander RosselS Sander Rossel

                    Started reading this huge book[^] (yes, VB and I'm proud of it! So don't start...) ;) Learning the "zammel" stuff, forgetting all I know about Events and Properties and thinking some very advanced controls are standard WPF stuff then finding out I have some DevExpress stuff installed... :doh: I've been planning this for months, and I finally started! Any tips for a WinForms going WPF programmer? (and no, I don't find this a programming question) :)

                    It's an OO world.

                    V Offline
                    V Offline
                    vonb
                    wrote on last edited by
                    #22

                    Good luck! I'm just converting a relatively big project from Winforms (it used to be excel 10 years ago...) XAML is great. Documentation is poor on official MSDN. I also use XBAP to make it Web easy. WCF (for data service) is also great. You will use a lot of dispatching, have a lot of crashes... Have fun!

                    1 Reply Last reply
                    0
                    • R Rage

                      Collin Jasnoch wrote:

                      infagistics[^].

                      I love your (subtlety ? lapsus ?) contraction: infamous U infragistics = infagistics.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #23

                      Yeah typos suck.. but should they result in a 1 vote??

                      Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                      P 1 Reply Last reply
                      0
                      • L Lost User

                        Yeah typos suck.. but should they result in a 1 vote??

                        Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #24

                        Maybe an infragistics dev did it.

                        Forgive your enemies - it messes with their heads

                        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                        1 Reply Last reply
                        0
                        • L Lost User

                          Ian Shlasko wrote:

                          1. Forget everything you know about interfaces and design tiers. WPF is a completely different paradigm.
                          2. Learn to love XAML. It's weird and awkward at first, but once you get used to it, it's magic.
                          3. In a perfect world, your code-behind should NEVER* have to refer to a GUI control. Don't even assign names to your controls unless you need to refer to them from a trigger or storyboard.

                          1. Forget that you are programmer. Now you are computer graphics maker/script writer. 2. Learn not to hate XAML. 3. Write more code and XAML than necessary. Make it more and more complicated. But never write code-behind. Real man doesn't write code-behind!

                          realJSOPR Offline
                          realJSOPR Offline
                          realJSOP
                          wrote on last edited by
                          #25

                          Amen brother... I just posted an update to an article series of mine with a WPF app that creates charts. The entire chart is created in code instead of XAML (with the exception of a few control templates for tooltips). I hate XAML (which is probably going to make my WPF/Silverlight experience less than fulfilling).

                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                          -----
                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                          -----
                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                          1 Reply Last reply
                          0
                          • L Lost User

                            Ian Shlasko wrote:

                            The code-behind is the glue that links the GUI to the model... Ideally, that's ALL it does... Realistically, the lines tend to blur a little with more complex applications.

                            Espeacially when using things like infragistics[^]. [EDIT] Correct spelling of Infragistics... I wonder if that is what got me the 1 :((

                            Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                            modified on Tuesday, August 30, 2011 10:14 AM

                            realJSOPR Offline
                            realJSOPR Offline
                            realJSOP
                            wrote on last edited by
                            #26

                            I spell it Infrashitstix. I've used their stuff, and we scrapped it and moved to the Silverlight toolkit instead.

                            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                            -----
                            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                            -----
                            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                            1 Reply Last reply
                            0
                            • Sander RosselS Sander Rossel

                              It can't be THAT bad... Right? :confused: Well, I'm still young and flexible so perhaps I can just sort of roll into it... Maybe ;p

                              It's an OO world.

                              realJSOPR Offline
                              realJSOPR Offline
                              realJSOP
                              wrote on last edited by
                              #27

                              Naerling wrote:

                              It can't be THAT bad... Right?

                              Yes, it's that bad.

                              Naerling wrote:

                              Well, I'm still young and flexible

                              All that means is that you'll be able to more easily bend over backwards to make your app work the way you want it.

                              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                              -----
                              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                              -----
                              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                              Sander RosselS 1 Reply Last reply
                              0
                              • P Pete OHanlon

                                If you have any ASP.NET in your background, this[^] might help a little bit to get you in the right mindset.

                                Forgive your enemies - it messes with their heads

                                My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                                realJSOPR Offline
                                realJSOPR Offline
                                realJSOP
                                wrote on last edited by
                                #28

                                Nope - won't help at all, with the possible exception of forming a closer bond with pointy brackets.

                                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                -----
                                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                -----
                                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                1 Reply Last reply
                                0
                                • realJSOPR realJSOP

                                  Naerling wrote:

                                  It can't be THAT bad... Right?

                                  Yes, it's that bad.

                                  Naerling wrote:

                                  Well, I'm still young and flexible

                                  All that means is that you'll be able to more easily bend over backwards to make your app work the way you want it.

                                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                  -----
                                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                  -----
                                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                  Sander RosselS Offline
                                  Sander RosselS Offline
                                  Sander Rossel
                                  wrote on last edited by
                                  #29

                                  John Simmons / outlaw programmer wrote:

                                  Yes, it's that bad.

                                  Recommendation to stay with WinForms? :~

                                  John Simmons / outlaw programmer wrote:

                                  All that means is that you'll be able to more easily bend over backwards

                                  I'm a programmer... I sit on my ass all day. The moment I try to bend (whichever direction) my back, shoulders and neck start to hurt and I know I just should've stayed in my chair ;p

                                  John Simmons / outlaw programmer wrote:

                                  to make your app work the way you want it.

                                  If I can make it work at all (especially in WPF) ;)

                                  It's an OO world.

                                  realJSOPR 1 Reply Last reply
                                  0
                                  • Sander RosselS Sander Rossel

                                    John Simmons / outlaw programmer wrote:

                                    Yes, it's that bad.

                                    Recommendation to stay with WinForms? :~

                                    John Simmons / outlaw programmer wrote:

                                    All that means is that you'll be able to more easily bend over backwards

                                    I'm a programmer... I sit on my ass all day. The moment I try to bend (whichever direction) my back, shoulders and neck start to hurt and I know I just should've stayed in my chair ;p

                                    John Simmons / outlaw programmer wrote:

                                    to make your app work the way you want it.

                                    If I can make it work at all (especially in WPF) ;)

                                    It's an OO world.

                                    realJSOPR Offline
                                    realJSOPR Offline
                                    realJSOP
                                    wrote on last edited by
                                    #30

                                    Both Winforms and WPF suck in their own little ways. It really depends on where you like your suckage. By all means, give WPF a try (check out my Reputationator article series if you want to see the same app written for both platforms in a single download).

                                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                    -----
                                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                    -----
                                    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                    Sander RosselS 1 Reply Last reply
                                    0
                                    • realJSOPR realJSOP

                                      Both Winforms and WPF suck in their own little ways. It really depends on where you like your suckage. By all means, give WPF a try (check out my Reputationator article series if you want to see the same app written for both platforms in a single download).

                                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                      -----
                                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                      -----
                                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                      Sander RosselS Offline
                                      Sander RosselS Offline
                                      Sander Rossel
                                      wrote on last edited by
                                      #31

                                      I'll check them out! Quite a read though... :thumbsup:

                                      It's an OO world.

                                      1 Reply Last reply
                                      0
                                      • L Lost User

                                        Ian Shlasko wrote:

                                        1. Forget everything you know about interfaces and design tiers. WPF is a completely different paradigm.
                                        2. Learn to love XAML. It's weird and awkward at first, but once you get used to it, it's magic.
                                        3. In a perfect world, your code-behind should NEVER* have to refer to a GUI control. Don't even assign names to your controls unless you need to refer to them from a trigger or storyboard.

                                        1. Forget that you are programmer. Now you are computer graphics maker/script writer. 2. Learn not to hate XAML. 3. Write more code and XAML than necessary. Make it more and more complicated. But never write code-behind. Real man doesn't write code-behind!

                                        T Offline
                                        T Offline
                                        thrakazog
                                        wrote on last edited by
                                        #32

                                        Alex Fr wrote:

                                        2. Learn not to hate XAML.

                                        I'm just not sure that will ever happen. The hate may have become a little less searing, but it's still there.

                                        Alex Fr wrote:

                                        3. Write more code and XAML than necessary. Make it more and more complicated. But never write code-behind. Real man doesn't write code-behind!

                                        I once worked in a place that took this idea to the extreme whenever they could. Impossible to describe so much failure, should have sent a poet. :wtf:

                                        1 Reply Last reply
                                        0
                                        • Sander RosselS Sander Rossel

                                          Started reading this huge book[^] (yes, VB and I'm proud of it! So don't start...) ;) Learning the "zammel" stuff, forgetting all I know about Events and Properties and thinking some very advanced controls are standard WPF stuff then finding out I have some DevExpress stuff installed... :doh: I've been planning this for months, and I finally started! Any tips for a WinForms going WPF programmer? (and no, I don't find this a programming question) :)

                                          It's an OO world.

                                          B Offline
                                          B Offline
                                          BotCar
                                          wrote on last edited by
                                          #33

                                          Naerling wrote:

                                          Any tips for a WinForms going WPF programmer?

                                          First off, forget about the "Forget everything you know..." ideas out there. It's different, but it's still programming. In the end, you will still spend a lot of your time worrying about program flow, threading, inheritance, assembly references, and all sorts of other things you had to deal with in WinForms. To me it seems like WPF differs from WinForms mainly in two ways: 1) The GUI components is different. 2) The way your "working" code (the code that actually does stuff) interacts with the GUI is different. Now, to elaborate on the above two points: 1) This is, of course, the "zammel stuff" as you call it. As in WinForms, the IDE allows you to design the GUI completely through drag-and-drop, and generates the corresponding code for you. But unlike WinForms, WPF generates code in the form of XAML files. These are nothing more than specialized XML files, so it's not hard to read and understand the syntax. This also lessens the "don't touch the auto generated code because you will break it and your changes will be overwritten when it is re-generated" attitude. It's easy to look at and edit the XAML directly, so you don't have to rely on the GUI builder for every small change you want to make. 2) By now I'm sure that someone would have told you about data binding :) . This is the big selling point of WPF, and the biggest thing that you will have to get used to. If you go the WPF route, you will find yourself pretty much abandoning event handlers in favour of binding. This is because ANY property on a visual control can be bound to a property in you code. You can have a bool to specify if a control should be enabled or not. You can bind a label or textbox's text to a string, or even both to the same string if you wish. You can... you know what, just read your book; you'll find out that there are tonnes of fancy stuff you can do with data binding that will make your life easier. Keep in mind that the biggest advantage of data binding is to separate presentation from logic. This will help you fight the urge to revert to WinForm habits, such as accessing a control's properties through an object of the control. In essence, all properties that you might want to change should be bound, and then you change your properties instead of those of the control. If possible, try to position yourself so that designers create the XAML files and then hands it over to you

                                          Sander RosselS 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups