Hello,
I am using DataTemplate as dynamical content resource for a user control and I am also trying to set the user control's DataContext to an ProjectResourceFilterDate object so that the edit can be collected. But for some reason (that i donot know ), the binding does not work and the values can not be retrived. What's missing here? How to bind DataTemplate to data?
<Windowxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:Custom="http://infragistics.com/Windows" xmlns:Custom1="http://infragistics.com/Editors" x:Class="Filter"
xmlns:res="clr-namespace:Intedis.Project4Cloud.My.Resources"
Title="Filter" Height="290" Width="407" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Loaded="Window_Loaded" >
<Window.Resources>
<DataTemplate x:Key="gridProjectResourcesFilter">
<Grid DataContext="{Binding}">
<TextBlock HorizontalAlignment="Left" Height="25" Margin="24,16,0,0" TextWrapping="Wrap" Text="Order Data From" VerticalAlignment="Top" Width="97"/>
<Custom1:XamDateTimeEditor Value="{Binding Path=OrderDateFrom}" HorizontalAlignment="Left" Height="25" Margin="138,16,0,0" VerticalAlignment="Top" Width="81"/>
<Custom1:XamDateTimeEditor Value="{BindingOrderDateTo}" HorizontalAlignment="Left" Height="25" Margin="280,15,0,0" VerticalAlignment="Top" Width="77"/>
<TextBlock HorizontalAlignment="Left" Height="25" Margin="24,55,0,0" TextWrapping="Wrap" Text="Category" VerticalAlignment="Top" Width="97"/>
<Custom1:XamComboEditor DisplayMemberPath="Name" ValuePath="ID" HorizontalAlignment="Left" Height="25" Margin="138,55,0,0" VerticalAlignment="Top" Width="219" " />
<TextBlock HorizontalAlignment="Left" Height="25" Margin="24,95,0,0" TextWrapping="Wrap" Text="Type" VerticalAlignment="Top" Width="73"/>
<Custom1:XamComboEditor DisplayMemberPath="Name" ValuePath="ID" HorizontalAlignment="Left" Height="25" Margin="138,95,0,0" VerticalAlignment="Top" Width="219" />
<TextBlock HorizontalAlignment="Left" Margin="251,21,0,0" TextWrapping="Wrap" Text="To" VerticalAlignment="Top" RenderTransformOrigin="0.652,-0.344"/>
</Grid>
</DataTemplate>
<Grid>
<UserControl x:Name="userCtrl" ContentTemplate="{DynamicResource gridEmployeeCustomerFilter}" Margin="-2,0,2,0" >
</UserControl>
</Grid>
</Window>
Partial Public Class ProjectResourceFilterDate
Public Property OrderDateTo As Nullable(Of Date)
End Class
eddy hu