[RESOLVED] Template v UserControl-VBForums
Results 1 to 2 of 2

Thread: [RESOLVED] Template v UserControl

  1. #1

    Thread Starter
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Resolved [RESOLVED] Template v UserControl

    Hi - Still new to WPF and trying to get my head round the proper way of doing things.

    I want to create a listbox which displays a reasonably complex structure for each item. What I envisage is something like two rows of text (which themselves may be made up from the values of several properties) and one or more buttons, including one to "delete" the item itself.

    I have been able to set up the listbox to do most of that using DataTemplate and Style manipulation, except for implementing the buttons which I'm struggling to see how I would work it this way.

    Would I better off defining a usercontrol which includes the structure I want and all the buttons, but then how do I get my listbox to use it? At the moment my ViewModel for the list contains a collection of another ViewModel type which represents the item - should I have the list ViewModel contain a collection of my usercontrol instead? That doesn't feel right.

    I'm probably just going round in circles over something thats fairly obvious but at the moment I cant see the wood for the trees.

  2. #2

    Thread Starter
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Template v UserControl

    'SOkay - I figured it out.

    A combination of the two approaches does the trick - using a DataTemplate to reference the user control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.