LockablePivot throws InvalidCastException
本文关键字:InvalidCastException throws LockablePivot | 更新日期: 2023-09-27 18:27:54
我正在尝试实现Windows Phone Toolkit-2011年8月(7.1 SDK)版本中的lockablePivot控件。
每次在运行时更改isLocked属性时,向控件添加项模板时,它都会引发InvalidCastException。有什么解决办法吗?
需要帮助。感谢
<Grid x:Name="LayoutRoot" Background="Transparent">
<toolkit:LockablePivot Name="Pages" SelectionChanged="Pivot_Changed" ItemsSource="{Binding}">
<toolkit:LockablePivot.ItemTemplate>
<DataTemplate>
<Grid VerticalAlignment="Stretch">
<Button Content="Lock" Click="Button_Click"/>
<Image Stretch="Uniform" local:WP7ImageZoomer.IsZoomingEnabled="True" ManipulationStarted="Image_ManipulationStarted" ManipulationCompleted="Image_ManipulationCompleted" ManipulationDelta="Image_ManipulationDelta" CacheMode="BitmapCache">
<Image.Source>
<BitmapImage x:Name="Bit" UriSource="{Binding Img}" DownloadProgress="BitmapImage_DownloadProgress" CreateOptions="BackgroundCreation"/>
</Image.Source>
</Image>
</Grid>
</DataTemplate>
</toolkit:LockablePivot.ItemTemplate>
</toolkit:LockablePivot>
</Grid>
C#:
private void Image_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
{
this.Pages.IsLocked = true;// Throws InvalidCastException here
}
private void Image_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
{
this.Pages.IsLocked = false;
}
private void Image_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
{
//this.Pages.IsLocked = true;
}
这个bug有一个开放的票证。看见http://silverlight.codeplex.com/workitem/10793.请不要忘记投票。