Click here to Skip to main content
       

Silverlight / WPF

 
AnswerRe: Data display issue with combo box in wpf data grid PinmvpRichard MacCutchan1-Apr-13 22:48 
QuestionGet File Path from ListView PinmemberMumbleB31-Mar-13 4:44 
AnswerRe: Get File Path from ListView PinmemberMycroft Holmes31-Mar-13 13:39 
GeneralRe: Get File Path from ListView PinmemberMumbleB1-Apr-13 1:34 
GeneralRe: Get File Path from ListView PinmemberMycroft Holmes1-Apr-13 2:23 
GeneralRe: Get File Path from ListView PinmemberMumbleB2-Apr-13 10:10 
GeneralRe: Get File Path from ListView PinmemberMycroft Holmes2-Apr-13 13:15 
GeneralRe: Get File Path from ListView [modified] PinmemberMumbleB3-Apr-13 8:27 
QuestionCollection of User Controls PinmemberMycroft Holmes30-Mar-13 23:44 
AnswerRe: Collection of User Controls PinmemberSledgeHammer0131-Mar-13 15:48 
GeneralRe: Collection of User Controls PinmemberMycroft Holmes31-Mar-13 15:55 
GeneralRe: Collection of User Controls PinmemberSledgeHammer0131-Mar-13 16:13 
GeneralRe: Collection of User Controls PinmemberMycroft Holmes31-Mar-13 16:30 
GeneralRe: Collection of User Controls PinmemberSledgeHammer0131-Mar-13 16:43 
Sounds like we are saying pretty much the same thing, but you don't like my semantics lol Smile | :) .
 
Ok, so Section is a model an observable POCO. Check.
 
UC UserControl = DataTemplate for an item.
 
Here is where you are arguing semantics. You say you need a VM for binding to the UC UserControl / DataTemplate... I'm agreeing with you, but saying it needs to be part of Section. Then you can bind as normal.
 
If you still want to argue semantics, you can do something like:
 
class Section
{
public Prop1
public Prop2
public Prop3
ViewModelBase ViewModel;
}
 
and then in your XAML, you could either do:
 
<MyUserControl /> and the DataContext will point to the Section object and you can reference the VM from there using Path=ViewModel.Blah;
 
Or if you want to be pedantic, you can do:
 
<MyUserControl DataContext="{Binding ViewModel}" />
 
and the MyUserControl will only get the ViewModel rather then the whole Section object. Either way works, but the VM / sub object / whatever you want to call it, has to be part of Section since that is what you are binding to.
 
If you don't want to do that for whatever reason, the only other thing you can probably do if you want to get all tricky is use DataTemplates to instantiate the VMs based on something in the Section object, but that would require modifying how the item creation works and the end result will be that you could have just stuck your "VM" into the section object and achieved the same thing and kept a few more hairs Smile | :) .
GeneralRe: Collection of User Controls PinmemberMycroft Holmes31-Mar-13 16:59 
GeneralRe: Collection of User Controls PinmemberSledgeHammer0131-Mar-13 17:20 
GeneralRe: Collection of User Controls PinmemberMycroft Holmes31-Mar-13 19:02 
QuestionWPF ComboBox With User Control PinmemberKevin Marois30-Mar-13 11:24 
AnswerRe: WPF ComboBox With User Control(This may not work.) Pinmemberfrazzle-me30-Mar-13 11:52 
GeneralRe: WPF ComboBox With User Control(This may not work.) PinmemberKevin Marois30-Mar-13 12:09 
GeneralRe: WPF ComboBox With User Control(This may not work.) Pinmemberfrazzle-me30-Mar-13 12:24 
AnswerRe: WPF ComboBox With User Control PinmemberSledgeHammer0130-Mar-13 14:19 
GeneralWindows 8 WPF Theme? Pinmemberavenger1928-Mar-13 18:20 
AnswerRe: Windows 8 WPF Theme? PinmemberCollin Jasnoch3-Apr-13 9:59 
GeneralRe: Windows 8 WPF Theme? PinmvpMeshack Musundi4-Apr-13 8:48 
QuestionC# WPF Accessing parameter of chosen data grid row Pinmemberjohnyjj228-Mar-13 10:55 
QuestionExtending WPF WebBrowser Control [modified] PinmemberCoxianuk28-Mar-13 7:48 
AnswerRe: Extending WPF WebBrowser Control [modified] PinmemberRichard Deeming28-Mar-13 10:19 
GeneralRe: Extending WPF WebBrowser Control [modified] PinmemberCoxianuk28-Mar-13 11:26 
GeneralRe: Extending WPF WebBrowser Control Pinmemberfrazzle-me28-Mar-13 11:52 
QuestionWindows Phone App Development using C# 2010 PinmemberTwiztedFreek26-Mar-13 19:16 
QuestionRe: Windows Phone App Development using C# 2010 PinmvpRichard MacCutchan27-Mar-13 0:00 
AnswerRe: Windows Phone App Development using C# 2010 PinmvpAbhinav S27-Mar-13 19:02 
QuestionLooking for a windows phone 7.1 XNA programmer PinmemberMember 955005526-Mar-13 0:09 
AnswerRe: Looking for a windows phone 7.1 XNA programmer PinmvpRichard MacCutchan26-Mar-13 1:09 
AnswerRe: Looking for a windows phone 7.1 XNA programmer PinmemberMarco Bertschi26-Mar-13 2:15 
QuestionCode-generated buttons in Stackpanel: how to handle events? PinmemberDirk.Bock22-Mar-13 13:24 
AnswerRe: Code-generated buttons in Stackpanel: how to handle events? PinmemberMycroft Holmes22-Mar-13 15:14 
AnswerRe: Code-generated buttons in Stackpanel: how to handle events? PinmemberGerry Schmitz22-Mar-13 15:51 
QuestionMVVM Tasks and UI Updating Pinmembercjb11022-Mar-13 2:44 
AnswerRe: MVVM Tasks and UI Updating PinmemberMatt T Heffron22-Mar-13 11:25 
GeneralRe: MVVM Tasks and UI Updating Pinmembercjb11024-Mar-13 23:37 
GeneralRe: MVVM Tasks and UI Updating Pinmembercjb11025-Mar-13 2:56 
GeneralRe: MVVM Tasks and UI Updating Pinmembercjb11025-Mar-13 5:45 
AnswerRe: MVVM Tasks and UI Updating PinmvpAbhinav S25-Mar-13 8:26 
GeneralRe: MVVM Tasks and UI Updating Pinmembercjb11025-Mar-13 8:36 
QuestionProblems on ListView Control in WPF Pinmemberbikah chanda mohanta21-Mar-13 3:56 
AnswerRe: Problems on ListView Control in WPF PinmemberKenneth Haugland22-Mar-13 3:03 
QuestionRoute Event for Button border PinmemberMember 878633518-Mar-13 21:50 
QuestionWPF treeview with circular reference not updating the childTreeviewItem Pinmembergeetha naidu17-Mar-13 1:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 20 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid