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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. Binding to UserControl's inner item's property without code-behind

Binding to UserControl's inner item's property without code-behind

Scheduled Pinned Locked Moved WPF
wpfquestioncsharpwcfregex
1 Posts 1 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.
  • H Offline
    H Offline
    hhrafn
    wrote on last edited by
    #1

    Using WPF, while following the MVVM pattern, I'm constructing a digital version of a paper form. This paper form has many fields that need to be filled out. The fields are basicly boxes with the title of the field inside it, then you write the appopriate data into the box. I was wondering if I should use a UserControl to solve this repedative taks of all these many boxes. All with different titles and data, but having basically the same look. So I constructed a UserControl with one Label (name="Title") and a TextBox (name="Text"). Now, if I have a ViewModel as DataContext for the form window (which contains all of these UserControl-fields, how can I bind the properties of the ViewModel to the content properties of the Lable and TextBox? I'm hoping I won't have to add any codebehind to the UserControl just to make Properties. Is there some nifty thing I can do here? Am I on the right path even, should I perhaps just stick to datatemplates somehow ? .. or just make one huge form with many many manu labels and textboxes ? :confused:

    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