CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    114

    Unhappy 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..

  2. #2
    Join Date
    Jan 2011
    Posts
    4

    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
  •  





Click Here to Expand Forum to Full Width

Featured