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. Can Someone hazard a guess?

Can Someone hazard a guess?

Scheduled Pinned Locked Moved The Lounge
csharplearningvisual-studiowpfwinforms
27 Posts 15 Posters 1 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.
  • N Nish Nishant

    Rama Krishna Vavilala wrote:

    It's there. You need to look at the right "Application".

    Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?

    Regards, Nish


    Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
    My latest book : C++/CLI in Action / Amazon.com link

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

    Nishant Sivakumar wrote:

    Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?

    See my answer below.

    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

    My blog | My articles | MoXAML PowerToys

    1 Reply Last reply
    0
    • realJSOPR realJSOP

      ...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of Label.Text, we have Label.Content, and instead of Control.Enable, we got Control.IsEnabled. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5? And imagine my surprise to find out that I have to use the DispatchTimer class instead of the System.Timers.Timer class...

      "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
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

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

      For the same reason the Winforms Webbrowser changed from Text to DocumenText. X|

      Visit http://www.notreadytogiveup.com/[^] and do something special today.

      1 Reply Last reply
      0
      • N Nish Nishant

        Rama Krishna Vavilala wrote:

        It's there. You need to look at the right "Application".

        Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?

        Regards, Nish


        Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
        My latest book : C++/CLI in Action / Amazon.com link

        R Offline
        R Offline
        Rama Krishna Vavilala
        wrote on last edited by
        #15

        John is probably confused between System.Windows.Forms.Application (WinForms + has StartupPath) and System.Windows.Application (WPF). Both are different.

        N 1 Reply Last reply
        0
        • P Pete OHanlon

          John Simmons / outlaw programmer wrote:

          And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5?

          You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #16

          Pete O'Hanlon wrote:

          You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.

          Nice, though I probably won't do it that way to avoid the WinForms reference. That just uses GetModuleFileName anyway.

          Regards, Nish


          Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
          My latest book : C++/CLI in Action / Amazon.com link

          P 1 Reply Last reply
          0
          • R Rama Krishna Vavilala

            John is probably confused between System.Windows.Forms.Application (WinForms + has StartupPath) and System.Windows.Application (WPF). Both are different.

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #17

            Rama Krishna Vavilala wrote:

            John is probably confused between System.Windows.Forms.Application (WinForms + has StartupPath) and System.Windows.Application (WPF). Both are different.

            Ah okay. You meant that he didn't realize that this is a whole new class.

            Regards, Nish


            Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
            My latest book : C++/CLI in Action / Amazon.com link

            1 Reply Last reply
            0
            • N Nish Nishant

              Pete O'Hanlon wrote:

              You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.

              Nice, though I probably won't do it that way to avoid the WinForms reference. That just uses GetModuleFileName anyway.

              Regards, Nish


              Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
              My latest book : C++/CLI in Action / Amazon.com link

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

              Indeed - I actually use this:

              public static class Utility
              {
              [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
              public static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);

              private static string startupPath;
              private static HandleRef NullHandleRef = new HandleRef();

              public static string StartupPath()
              {
              if (startupPath == null)
              {
              StringBuilder buffer = new StringBuilder(260);
              GetModuleFileName(NullHandleRef, buffer, buffer.Capacity);
              startupPath = Path.GetDirectoryName(buffer.ToString());
              }
              new FileIOPermission(FileIOPermissionAccess.PathDiscovery, startupPath).Demand();
              return startupPath;
              }
              }

              God bless Reflector.

              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

              My blog | My articles | MoXAML PowerToys

              1 Reply Last reply
              0
              • M Michael Bookatz

                So what do you use instead of Datagrid?

                D Offline
                D Offline
                Dan Neely
                wrote on last edited by
                #19

                DataGridView. DataGrid was the 1.0 framework attempt at the same. it sucked massively.

                Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                T 1 Reply Last reply
                0
                • realJSOPR realJSOP

                  ...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of Label.Text, we have Label.Content, and instead of Control.Enable, we got Control.IsEnabled. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5? And imagine my surprise to find out that I have to use the DispatchTimer class instead of the System.Timers.Timer class...

                  "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
                  -----
                  "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                  P Offline
                  P Offline
                  peterchen
                  wrote on last edited by
                  #20

                  Developed by a different team. Such differences are usually a mix of different style guide lines (e.g. "All boolean properties should start with Is, Are, or Can"), different tastes ("X always irked me, I'd prefer Y"), and ignorance ("We are the cool guys, why should we know WinForms at all?")

                  Burning Chrome ^ | Linkify!| FoldWithUs! | sighist

                  1 Reply Last reply
                  0
                  • D Dan Neely

                    DataGridView. DataGrid was the 1.0 framework attempt at the same. it sucked massively.

                    Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                    T Offline
                    T Offline
                    ToddHileHoffer
                    wrote on last edited by
                    #21

                    The data grid was serviceable at best. The Gridview was completely redone. Many of the changes seemed logical rather than arbitrary.

                    I didn't get any requirements for the signature

                    1 Reply Last reply
                    0
                    • M Michael Bookatz

                      Nishant Sivakumar wrote:

                      The WPF equivalent of the WinForms Label control is actually TextBlock (which has a Text property). The WPF Label is actually a heavier more complex control - so wherever you used a Label in WinForms, in WPF you should be using TextBlock.

                      SO why not have the new heavier control called TextBlock a new name not used before! Why confuse what everyone knows to be the standard!

                      C Offline
                      C Offline
                      cpkilekofp
                      wrote on last edited by
                      #22

                      To see if you're actually paying attention, of course! :D

                      1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        ...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of Label.Text, we have Label.Content, and instead of Control.Enable, we got Control.IsEnabled. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5? And imagine my surprise to find out that I have to use the DispatchTimer class instead of the System.Timers.Timer class...

                        "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
                        -----
                        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                        S Offline
                        S Offline
                        Simon P Stevens
                        wrote on last edited by
                        #23

                        Winforms and WPF are different frameworks. WPF is not an upgrade or new version of winforms. Why should one act like the other in any way? The content property (like others have said) can contain more that just text so naming it Text because of some obscure relationship with a totally different framework would be crazy.

                        Simon

                        1 Reply Last reply
                        0
                        • E Electron Shepherd

                          John Simmons / outlaw programmer wrote:

                          of Label.Text, we have Label.Content

                          Presumably becuase it can (or might in the future) have "non-text" stuff in it (HTML etc) *

                          John Simmons / outlaw programmer wrote:

                          instead of Control.Enable, we got Control.IsEnabed

                          This one makes sense to me. Enable is a verb (method) wheras IsEnabled is a state (property) * I don't do any WPF work, so the control may already support formatted content for all I know.

                          Server and Network Monitoring

                          B Offline
                          B Offline
                          Brady Kelly
                          wrote on last edited by
                          #24

                          Electron Shepherd wrote:

                          instead of Control.Enable, we got Control.IsEnabed This one makes sense to me. Enable is a verb (method) wheras IsEnabled is a state (property)

                          Agreed on that, but I think John meant to say '.Enabled' vs '.IsEnabled', in which case both are clearly states. I've never come across a bool called 'Enable' on a control, but the word could server a valid purpose in the sense of a 'command' flag, meaning 'you must enable this control', vs. 'this control is enabled'.

                          1 Reply Last reply
                          0
                          • realJSOPR realJSOP

                            ...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of Label.Text, we have Label.Content, and instead of Control.Enable, we got Control.IsEnabled. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5? And imagine my surprise to find out that I have to use the DispatchTimer class instead of the System.Timers.Timer class...

                            "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
                            -----
                            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                            T Offline
                            T Offline
                            ToddHileHoffer
                            wrote on last edited by
                            #25

                            Don't forget how lucky you are to be coding with the latest and greatest from Microsoft. Think about all of poor developers who have to program with 3.5 .net framework using ASP.Net and WinForms. We don't have awesome manager who let us code everything for SilverLight...

                            I didn't get any requirements for the signature

                            realJSOPR 1 Reply Last reply
                            0
                            • realJSOPR realJSOP

                              ...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of Label.Text, we have Label.Content, and instead of Control.Enable, we got Control.IsEnabled. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5? And imagine my surprise to find out that I have to use the DispatchTimer class instead of the System.Timers.Timer class...

                              "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
                              -----
                              "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                              C Offline
                              C Offline
                              Chris Maunder
                              wrote on last edited by
                              #26

                              Some call it annoying. Some call it an opportunity. An opportunity for Job Security ;)

                              cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

                              1 Reply Last reply
                              0
                              • T ToddHileHoffer

                                Don't forget how lucky you are to be coding with the latest and greatest from Microsoft. Think about all of poor developers who have to program with 3.5 .net framework using ASP.Net and WinForms. We don't have awesome manager who let us code everything for SilverLight...

                                I didn't get any requirements for the signature

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

                                I'd rather code in WinForms. Actually, I'd rather do un-managed code...

                                "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
                                -----
                                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                                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