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. General Programming
  3. WPF
  4. control is not accessible in code behind

control is not accessible in code behind

Scheduled Pinned Locked Moved WPF
wpfcsharpvisual-studiodesignquestion
8 Posts 4 Posters 0 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.
  • S Offline
    S Offline
    SRKSHOME
    wrote on last edited by
    #1

    Hi, I have few simple controls defined in xaml in wpf. In the code behind when I try to access this control they are coming up and also coming in VS intellisence. But during run time these controls are always null. as a result UI doesn't show. Any reasons? Thanks

    S M 2 Replies Last reply
    0
    • S SRKSHOME

      Hi, I have few simple controls defined in xaml in wpf. In the code behind when I try to access this control they are coming up and also coming in VS intellisence. But during run time these controls are always null. as a result UI doesn't show. Any reasons? Thanks

      S Offline
      S Offline
      SledgeHammer01
      wrote on last edited by
      #2

      are you calling InitializeComponent()?

      S 1 Reply Last reply
      0
      • S SledgeHammer01

        are you calling InitializeComponent()?

        S Offline
        S Offline
        SRKSHOME
        wrote on last edited by
        #3

        yes..that is being called

        S 1 Reply Last reply
        0
        • S SRKSHOME

          Hi, I have few simple controls defined in xaml in wpf. In the code behind when I try to access this control they are coming up and also coming in VS intellisence. But during run time these controls are always null. as a result UI doesn't show. Any reasons? Thanks

          M Offline
          M Offline
          manognya kota
          wrote on last edited by
          #4

          Hi, Is the runat="server" attribute attached to the control? can you post code of atleast one control? -Manognya __________________________________________________ $ God gives what is best.Not what all you wish :)

          P 1 Reply Last reply
          0
          • M manognya kota

            Hi, Is the runat="server" attribute attached to the control? can you post code of atleast one control? -Manognya __________________________________________________ $ God gives what is best.Not what all you wish :)

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

            manognya kota wrote:

            Is the runat="server" attribute attached to the control?

            Why would it be? He's using WPF, which doesn't have this attribute.

            Forgive your enemies - it messes with their heads

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

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

            M 1 Reply Last reply
            0
            • P Pete OHanlon

              manognya kota wrote:

              Is the runat="server" attribute attached to the control?

              Why would it be? He's using WPF, which doesn't have this attribute.

              Forgive your enemies - it messes with their heads

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

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

              M Offline
              M Offline
              manognya kota
              wrote on last edited by
              #6

              Oops!! My mistake...Thanks for the correction.dint notice its WPF -Manognya __________________________________________________ $ God gives what is best.Not what all you wish :)

              1 Reply Last reply
              0
              • S SRKSHOME

                yes..that is being called

                S Offline
                S Offline
                SledgeHammer01
                wrote on last edited by
                #7

                Then run with first chance exceptions turned on. Should tell you what the problem is.

                S 1 Reply Last reply
                0
                • S SledgeHammer01

                  Then run with first chance exceptions turned on. Should tell you what the problem is.

                  S Offline
                  S Offline
                  SRKSHOME
                  wrote on last edited by
                  #8

                  thanks...I have fixed...Somehow InitinitializeComponent() was not being called..

                  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