Salve a tutti ho il seguente problema.
ho la necessità di creare diversi datatemplate per la stessa pagina
e selezionare quello giusto a secondo della variabile
il codice della pagina e' il seguente
phone:PhoneApplicationPage
x:Class="Memory.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tools="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="DataTemplate1">
<Image x:Name="_image" Source="{Binding Image}" Width="100" Height="100"/>
</DataTemplate>
<DataTemplate x:Key="DataTemplate2">
<Image x:Name="_image" Source="{Binding Image}" Width="105" Height="105"/>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" >
<Grid.Background>
<LinearGradientBrush >
<GradientStop Color="{Binding Path=LocalVar.ColoreSfondo, Source={StaticResource Memoria}}" />
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Height="auto">
<TextBlock x:Name="ApplicationTitle" Text ="Memoria" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Classic" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" />
<TextBlock x:Name="tentativi" Text="Tentativi" />
<ListBox Height="600" Margin="0,20,0,0 " Width="470" x:Name="_listBox" ItemTemplate="{StaticResource DataTemplate2}" ItemsSource="{Binding Cards}"
SelectionChanged="_listBox_SelectionChanged">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<tools:WrapPanel Name="pan" ItemHeight="110" ItemWidth="110"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</StackPanel>
</Grid>
</phone:PhoneApplicationPage>
il mio problema e' che non so
<ListBox Height="600" Margin="0,20,0,0 " Width="470" x:Name="_listBox" ItemTemplate="{StaticResource DataTemplate2}"
come impostare un altro datatemplate e modificare anche i valori del controllo pan che devono cambiare in base al datatemplate scelto
spero di essere stato chiaro nell'esporre il problema grazie e buona giornata..