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. Listbox / Button Text update

Listbox / Button Text update

Scheduled Pinned Locked Moved WPF
visual-studiowpfannouncement
6 Posts 2 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.
  • U Offline
    U Offline
    User 8442265
    wrote on last edited by
    #1

    Hey all, I am working on some code for Silverlight / windows phone: I have 2 Xaml pages , Main and Second page: Main page , I have a button. With default text. " button" I have an OnHold event, that navigates to Second.xaml page. On Second.xaml page is a ListBox. With lets say 3 ListBoxItems. item1, item2 and item3. Here's where I am lost. I want to have my selected item() 1 2 or 3, do 2 things: 1. Update the text in the button on the MainPage.xaml. The text says "item1" or whateveritem I selected. 2. The selected item in the listbox also selects an object in a folder. Call this folder resources. and the objects lets say are text or png files or whatever...just something I created outside of the IDE. I wil worry about any OnClick functions or what to do with the objects in the folder later. Its the selection / update upon multiple pages that gets me right now.

    S 1 Reply Last reply
    0
    • U User 8442265

      Hey all, I am working on some code for Silverlight / windows phone: I have 2 Xaml pages , Main and Second page: Main page , I have a button. With default text. " button" I have an OnHold event, that navigates to Second.xaml page. On Second.xaml page is a ListBox. With lets say 3 ListBoxItems. item1, item2 and item3. Here's where I am lost. I want to have my selected item() 1 2 or 3, do 2 things: 1. Update the text in the button on the MainPage.xaml. The text says "item1" or whateveritem I selected. 2. The selected item in the listbox also selects an object in a folder. Call this folder resources. and the objects lets say are text or png files or whatever...just something I created outside of the IDE. I wil worry about any OnClick functions or what to do with the objects in the folder later. Its the selection / update upon multiple pages that gets me right now.

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

      You mean auto select a file / folder in an external Windows Explorer window? You can just do something like: System.Diagnostics.Process.Start("explorer.exe", avi.Path); and it will auto-select the folder / file in avi.Path for you. Does Main have a reference to Second? or does Second have a reference to Main? Really, in proper MVVM, they shouldn't know about each other, so you should use something like a messenger service to communicate between views.

      U 1 Reply Last reply
      0
      • S SledgeHammer01

        You mean auto select a file / folder in an external Windows Explorer window? You can just do something like: System.Diagnostics.Process.Start("explorer.exe", avi.Path); and it will auto-select the folder / file in avi.Path for you. Does Main have a reference to Second? or does Second have a reference to Main? Really, in proper MVVM, they shouldn't know about each other, so you should use something like a messenger service to communicate between views.

        U Offline
        U Offline
        User 8442265
        wrote on last edited by
        #3

        Well actually I think simpler than that? this is strictly going to be a windows phone application using a couple xaml pages. No windows.exe or anything like that. so no mesenger service either as navigating from one xaml to another in a windows phone app is normal and accepted.

        S 1 Reply Last reply
        0
        • U User 8442265

          Well actually I think simpler than that? this is strictly going to be a windows phone application using a couple xaml pages. No windows.exe or anything like that. so no mesenger service either as navigating from one xaml to another in a windows phone app is normal and accepted.

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

          Do you have a reference to the other page? You could just subscribe to a simple event.

          U 1 Reply Last reply
          0
          • S SledgeHammer01

            Do you have a reference to the other page? You could just subscribe to a simple event.

            U Offline
            U Offline
            User 8442265
            wrote on last edited by
            #5

            A reference? Well the only reference I have in a snece is the button OnHold event navigationg to the second page.

            S 1 Reply Last reply
            0
            • U User 8442265

              A reference? Well the only reference I have in a snece is the button OnHold event navigationg to the second page.

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

              Hmm.. well, I'll have to hand you off to the Silverlight guys then. If you don't have a reference to the page and don't want to use messenger (which is really simple IMO), then I'd think you'd need a global static class that exposes an event or holds the references there. There might be something to handle that in Silverlight that I'm not aware of. In WPF, I'd certainly use messenger to communicate between views.

              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