我有這樣的代碼:Сhanging所選項目的列表框中(Windows phone)系統的圖像
<ListBox x:Name="lisbox1" Margin="-24,0,-9,0" CacheMode="BitmapCache" ItemsSource="{Binding Teacher}" HorizontalAlignment="Right" MouseLeftButtonUp="lisbox1_MouseLeftButtonUp" SelectionChanged="lisbox1_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,0,-35">
<Image x:Name="image1" Stretch="Fill" Source="ticket.png" Margin="-15,-16,3,21"/>
<TextBlock x:Name="asda" Margin="56,50,0,0" TextWrapping="Wrap" TextAlignment="Left" Text="{Binding lastname}" Style="{StaticResource PhoneTextLargeStyle}" Height="50" VerticalAlignment="Top" HorizontalAlignment="Left" Width="264" />
<TextBlock Margin="56,106,43,90" TextWrapping="Wrap" TextAlignment="Left" Text="{Binding firstname}" Style="{StaticResource PhoneTextLargeStyle}" />
<TextBlock Margin="0,50,43,147" Text="{Binding auditnumb}" Style="{StaticResource PhoneTextLargeStyle}" RenderTransformOrigin="0.515,-1.286" HorizontalAlignment="Right" Width="98" />
<Border Background="Silver" BorderThickness="1,1,1,1" Height="40" CornerRadius="20,20,20,20" Margin="56,3,60,0" VerticalAlignment="Top">
<TextBlock TextWrapping="Wrap" Text="{Binding subname}" TextAlignment="Center" VerticalAlignment="Top" Style="{StaticResource PhoneTextTitle3Style}"/>
</Border>
<Border BorderThickness="1" Height="40" Background="Green" Width="69" CornerRadius="25,25,25,25" Margin="316,154,61,41" Name="border1" >
<TextBlock Text="{Binding End}" TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource PhoneTextTitle3Style}" Width="69" Margin="-2,1,-3,-1"/>
</Border>
<Border BorderThickness="1" Background="Red" CornerRadius="25,25,25,25" Name="border2" Height="40" Width="69" Margin="230,154,147,41" >
<TextBlock TextAlignment="Center" TextWrapping="Wrap" Text="{Binding Start}" Style="{StaticResource PhoneTextTitle3Style}" Width="69" Margin="-2,1,-3,1"/>
</Border>
<Border Background="WhiteSmoke" CornerRadius="40" BorderThickness="1" Height="40" HorizontalAlignment="Left" Margin="16,88,0,0" Name="border3" VerticalAlignment="Top" Width="40" >
<TextBlock Margin="5" Foreground="Black" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding PairNumber}" Width="28" RenderTransformOrigin="0.304,-0.462" Style="{StaticResource PhoneTextNormalStyle}" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top"/>
</Border>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
如何改變形象,當你從列表框中選擇一個項目?我曾嘗試使用VisualStateManager,但沒有任何反應。
我已編輯我的文章,所以它只改變挖掘項:)讓我知道它是否工作/不 – Newbie