Hi
Can you show me how to accomplish this? I think I need to set a DataTemplateSelector and have each DataTemplate a UserControl. Also I would like to bind each UserControl's data to a different ViewModel.
Thanks!
Hello Marlon,
Thank you for your post. I have been looking into it and since the XamTileManager doesn’t have TemplateSelector I used another approach to achieve this functionality. I created a DataTemplate with two controls (Button and TextBlock) and based on value in the ViewModel only one of them is shown in the different Tiles. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
That is not quite what I need. Can you create a sample app that does something like this?
Thank you.
<UserControl x:Class="WpfApplication1.ImageTextControl">
<Grid>
<ig:XamTileManager Name="xamTileManager1" >
<ig:XamTileManager.Resources>
<DataTemplate x:Key="ImagesTemplate">
<StackPanel>
<!--I want to bind ColorImage to PhotoViewModel.ColorPhotoFileUri-->
<Image x:Key="ColorImage"
Source="{Binding ColorPhotoFileUri}"
Stretch="Fill" />
<!--I want to bind BlackWhiteImage to PhotoViewModel.BlackWhitePhotoFileUri-->
<Image x:Key="BlackWhiteImage"
Source="{Binding BlackWhitePhotoFileUri}"
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="TextTemplate">
<!--I want to bind to TextViewModel.FieldLabel-->
<TextBlock x:Name="FieldLabelText"
Text="{Binding FieldLabel}"
Grid.Column="0"/>
<!--I want to bind FieldValueText to TextViewModel.FieldValue-->
<TextBlock x:Name="FieldValueText"
Text="{Binding FieldValue}"
Grid.Column="1"/>
<data:ControlTemplateSelector x:Key="ImagesTemplateSelector"
ImagesTemplate="{StaticResource ImagesTemplate}"
TextTemplate="{StaticResource TextTemplate}" />
</ig:XamTileManager.Resources>
<ig:XamTileManager.ItemTemplateMaximized>
<DataTemplate>
<ContentPresenter Content="{Binding}" ContentTemplateSelector="{StaticResource ControlTemplateSelector}"/>
</ig:XamTileManager.ItemTemplateMaximized>
</ig:XamTileManager>
</Grid>
</UserControl>
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.