Click here to Skip to main content
15,890,670 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Get File Path from ListView Pin
Mycroft Holmes2-Apr-13 12:15
professionalMycroft Holmes2-Apr-13 12:15 
GeneralRe: Get File Path from ListView Pin
MumbleB3-Apr-13 7:27
MumbleB3-Apr-13 7:27 
QuestionCollection of User Controls Pin
Mycroft Holmes30-Mar-13 22:44
professionalMycroft Holmes30-Mar-13 22:44 
AnswerRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 14:48
SledgeHammer0131-Mar-13 14:48 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 14:55
professionalMycroft Holmes31-Mar-13 14:55 
GeneralRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 15:13
SledgeHammer0131-Mar-13 15:13 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 15:30
professionalMycroft Holmes31-Mar-13 15:30 
GeneralRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 15:43
SledgeHammer0131-Mar-13 15: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 Pin
Mycroft Holmes31-Mar-13 15:59
professionalMycroft Holmes31-Mar-13 15:59 
GeneralRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 16:20
SledgeHammer0131-Mar-13 16:20 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 18:02
professionalMycroft Holmes31-Mar-13 18:02 
QuestionWPF ComboBox With User Control Pin
Kevin Marois30-Mar-13 10:24
professionalKevin Marois30-Mar-13 10:24 
AnswerRe: WPF ComboBox With User Control(This may not work.) Pin
David C# Hobbyist.30-Mar-13 10:52
professionalDavid C# Hobbyist.30-Mar-13 10:52 
GeneralRe: WPF ComboBox With User Control(This may not work.) Pin
Kevin Marois30-Mar-13 11:09
professionalKevin Marois30-Mar-13 11:09 
GeneralRe: WPF ComboBox With User Control(This may not work.) Pin
David C# Hobbyist.30-Mar-13 11:24
professionalDavid C# Hobbyist.30-Mar-13 11:24 
AnswerRe: WPF ComboBox With User Control Pin
SledgeHammer0130-Mar-13 13:19
SledgeHammer0130-Mar-13 13:19 
GeneralWindows 8 WPF Theme? Pin
Member 982361928-Mar-13 17:20
Member 982361928-Mar-13 17:20 
GeneralRe: Windows 8 WPF Theme? Pin
Meshack Musundi4-Apr-13 7:48
professionalMeshack Musundi4-Apr-13 7:48 
QuestionC# WPF Accessing parameter of chosen data grid row Pin
johnyjj228-Mar-13 9:55
johnyjj228-Mar-13 9:55 
QuestionExtending WPF WebBrowser Control Pin
Coxianuk28-Mar-13 6:48
Coxianuk28-Mar-13 6:48 
AnswerRe: Extending WPF WebBrowser Control Pin
Richard Deeming28-Mar-13 9:19
mveRichard Deeming28-Mar-13 9:19 
GeneralRe: Extending WPF WebBrowser Control Pin
Coxianuk28-Mar-13 10:26
Coxianuk28-Mar-13 10:26 
GeneralRe: Extending WPF WebBrowser Control Pin
David C# Hobbyist.28-Mar-13 10:52
professionalDavid C# Hobbyist.28-Mar-13 10:52 
QuestionWindows Phone App Development using C# 2010 Pin
TwiztedFreek26-Mar-13 18:16
TwiztedFreek26-Mar-13 18:16 
QuestionRe: Windows Phone App Development using C# 2010 Pin
Richard MacCutchan26-Mar-13 23:00
mveRichard MacCutchan26-Mar-13 23:00 

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

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