Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. problem with ObjectDataProvider inside DataTemplate

problem with ObjectDataProvider inside DataTemplate

Scheduled Pinned Locked Moved WCF and WF
wpfhelpcsswcfquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Feras Mazen Taleb
    wrote on last edited by
    #1

    I have to Bind to Method inside DataTemplate for ListBoxItem so I need to use ObjectDataProvider to determine the Method name and ofcourse the ObjectInstance will be the Object that is bound to the List Box Item that will use this template But How can I tell the Provider [In xaml] to use the bound object as Object Instatnce :confused: I tried the following code but Compiler error I got :(( <DataTemplate x:Key="ListBoxItemTemplate" > <DataTemplate.Resources> <ObjectDataProvider x:Key="CurrentRoomStateProvider" ObjectInstance={Binding } MethodName="GetRoomStateForSpecificDay" > <ObjectDataProvider.MethodParameters> <sys:DateTime>10-30-2009</sys:DateTime> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> <ObjectDataProvider x:Key="CurrentRoomBookingWaitingsProvider" ObjectInstance={Binding } MethodName="GetBookingsWaitingForSpecificDay" > <ObjectDataProvider.MethodParameters> <sys:DateTime>10-30-2009</sys:DateTime> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> </DataTemplate.Resources> <Border BorderBrush="#FFA69FEC" BorderThickness="2" Height="143" Width="123" > <Grid Width="120" Margin="0,0,0,0" VerticalAlignment="Top" Height="140" HorizontalAlignment="Right"> <GroupBox Margin="3.89,27,3.205,52.89" Header="Room Detail :"> <Grid> <TextBlock Margin="2.863,3.205,0,0" Text="Floor :" TextWrapping="Wrap" HorizontalAlignment="Left" Width="33.33" VerticalAlignment="Top" Height="18.57"/> <TextBlock Margin="2.863,21.775,0,0" Text="Type :" TextWrapping="Wrap" HorizontalAlignment="Left" Width="33.33" VerticalAlignment="Top" Height="21.375"/> <TextBlock Text="{Binding Path=FloorName}" ToolTip="{Binding Path=FloorName}" VerticalAlignment="Top" Height="14.57" Margin="40.193,3.205,8,0"/> <TextBlock Text="{Binding Path=RoomTypeName}" ToolTip="{Binding Path=RoomTypeName}"

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups