-
February 2nd, 2011, 08:31 PM
#1
WPF binding with viewmodel property
I am trying to bind a commandparameter to a property of the viewmodel class for the view. the project is using MVVM.
<Hyperlink Command="{Binding Path=AddJobAssignmentCommand}">Add Assignment
<Hyperlink.Resources>
<vm:AddJobAssignmentMultiConverter x:Key="AddJobAssignmentMultiConverter"/>
</Hyperlink.Resources>
<Hyperlink.CommandParameter>
<MultiBinding Converter="{StaticResource ResourceKey=AddJobAssignmentMultiConverter}">
<Binding ElementName="lstTechnician" Path="SelectedValue"/>
<Binding ElementName="chkPrimary" Path="IsChecked"/>
<Binding ElementName="dtStartDate" Path="SelectedDate"/>
<Binding Path="StartTime" />
<Binding Path="EndTime" />
</MultiBinding>
</Hyperlink.CommandParameter>
</Hyperlink>
The problem is with the last two parameters "StartTime" and "EndTime". Although both the properties are available in the viewmodel class and in Debug mode I can see that they have value, the parameters are always carrying null value. I have tried binding with a property which is present in the viewmodelbase class, from where this viewmodel is inherited. the parameter gets the value from that property, while I try with any property in the child viewmodel class, it gets null..
-
April 3rd, 2011, 06:23 PM
#2
Re: WPF binding with viewmodel property
Can you post more code?
If you can't post more, start a new project that you can post with the minimal code to duplicate the issue and post that code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|