Hi All,
Perhaps its because its been a long week, but I just can't seem to figure
out how to bind data in a DataTemplate using DataContext.
The following is in the XAML code:
<Button x:Name="btnRegu larDataContext" Margin="5">
<TextBlock Text="{Binding} " />
</Button>
<Button x:Name="btnInDa taTemplate" Margin="5">
<Button.Content Template>
<DataTemplate >
<TextBlock Text="{Binding} " />
</DataTemplate>
</Button.ContentT emplate>
</Button>
And in the code-behind:
btnRegulareData Context.DataCon text = DateTime.Now.To ShortString();
btnInDataTempla te.DataContext = DateTime.Now.To ShortString();
The first button shows the time, the second does not. What am I missing?!?
Thanks....
Perhaps its because its been a long week, but I just can't seem to figure
out how to bind data in a DataTemplate using DataContext.
The following is in the XAML code:
<Button x:Name="btnRegu larDataContext" Margin="5">
<TextBlock Text="{Binding} " />
</Button>
<Button x:Name="btnInDa taTemplate" Margin="5">
<Button.Content Template>
<DataTemplate >
<TextBlock Text="{Binding} " />
</DataTemplate>
</Button.ContentT emplate>
</Button>
And in the code-behind:
btnRegulareData Context.DataCon text = DateTime.Now.To ShortString();
btnInDataTempla te.DataContext = DateTime.Now.To ShortString();
The first button shows the time, the second does not. What am I missing?!?
Thanks....