我正试着用这种方式飞出去
this.DefaultViewModel["SelectedVideo"] = vi;
Flyout f = new Flyout();
f.Content = this.videoFlyoutContent;
f.ShowAt(videosGrid); // HERE I GET AN EXCEPTION而我有下面的XAML代码
<Page.Resource>
<!-- ................ -->
<!-- ................ -->
<x:Double x:Key="FlyoutWidth">500</x:Double>
<x:Double x:Key="FlyoutHeight">440</x:Double>
<x:Double x:Key="FlyoutTextWidth">400</x:Double>
<ContentControl x:Name="videoFlyoutContent">
<Grid DataContext="{Binding SelectedVideo}" Width="{StaticResource FlyoutWidth}" Height="{StaticResource FlyoutHeight}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Source="{Binding thumbnail.hqDefault}" /> <!-- 480x360 -->
<TextBlock Grid.Row="1"
Text="{Binding Title}" TextTrimming="WordEllipsis" FontSize="16" FontWeight="SemiBold" TextWrapping="Wrap"
Style="{StaticResource UNIListItemStyle_TitleTextBlock}" HorizontalAlignment="Center" Width="{StaticResource FlyoutTextWidth}"
Foreground="{StaticResource VideoElement_TextForeground}"/>
</Grid>
</ContentControl>
</Page.Resources>现在,问题是我在f.showAt()中得到了一个f.showAt();
System.ArgumentException: Value does not fall within the expected range.
at Windows.UI.Xaml.Controls.Primitives.FlyoutBase.ShowAt(FrameworkElement placementTarget)如果删除行,则不会引发
f.Content = this.videoFlyoutContent;发布于 2014-05-12 10:45:44
简单地通过使用:
<Page.Resources>
<Flyout x:Name="myFlyout">
<Grid>...</Grid>
</Flyout>
</Page.Resources>和
myFlyout.showAt(videosGrid);但我不知道为什么它不是这样运作的。
https://stackoverflow.com/questions/23606049
复制相似问题