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. Design: Passing parameters [modified]

Design: Passing parameters [modified]

Scheduled Pinned Locked Moved WPF
csharpasp-netdatabasewpfdesign
2 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.
  • A Offline
    A Offline
    afsal qureshi
    wrote on last edited by
    #1

    Hello all, I am learning WPF now. I have a window which will launch a popup on click of a button. The popup contains a user control. I need to pass some parameters like first name,last name to the user control. I am from an asp.net background so my thought is like to pass these parameters as query string and assign it to the text box in popup. Any way, it is not possible in windows and I am sure there are better methods. I am thinking about declaring a public get-set property in the popup for each parameters(I don't think I need dependency property). Then I will assign the values from the window. Is it a good way of doing it? Thanks in advance, afsal

    modified on Wednesday, December 22, 2010 10:15 AM

    L 1 Reply Last reply
    0
    • A afsal qureshi

      Hello all, I am learning WPF now. I have a window which will launch a popup on click of a button. The popup contains a user control. I need to pass some parameters like first name,last name to the user control. I am from an asp.net background so my thought is like to pass these parameters as query string and assign it to the text box in popup. Any way, it is not possible in windows and I am sure there are better methods. I am thinking about declaring a public get-set property in the popup for each parameters(I don't think I need dependency property). Then I will assign the values from the window. Is it a good way of doing it? Thanks in advance, afsal

      modified on Wednesday, December 22, 2010 10:15 AM

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

      If your pop-up's job is to display first name and last name then I would guess that you probably have (for example) a Customer object, with properties of FirstName and LastName (for example) your usercontrol could bind to such an object your popup then would need an instance of that object to set as the datasource - so either have a public property

      public Customer CurrentCustomer
      {
      set
      {
      //Do your databinding here
      }
      }

      or have a constructor which takes a Customer as a parameter, and performs the binding. Using the property at least gives you the potential option of changing the Customer without closing and re-opening the pop up.

      ___________________________________________ .\\axxx (That's an 'M')

      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