c# – 如何在Windows 10 UWP中从屏幕右侧打开弹出窗口?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – 如何在Windows 10 UWP中从屏幕右侧打开弹出窗口?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3044字,纯文字阅读大概需要5分钟。
内容图文
![c# – 如何在Windows 10 UWP中从屏幕右侧打开弹出窗口?](/upload/InfoBanner/zyjiaocheng/966/34e7bbbd11924d788ad9f1da4399e351.jpg)
我正在使用Windows 10 App,我想在点击图像时从屏幕右侧打开一个弹出按钮.我不能使用SplitView,因为我已经将它用于其他目的.它的可见性应首先折叠,何时点击图像然后它应该是Visible.Also,我不使用导航/设置弹出窗口.我想实现以下目标
解决方法:
Its visibility should be Collapsed first and when to click on the image then it should be Visible.
您可以设置布局,例如:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<GridView ItemsSource="{x:Bind WaresCollection}">
<GridView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding WaresImage}" Tapped="Image_Tapped" Width="200" Height="300" />
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
<Grid x:Name="FilterGrid" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Background="#33000000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Grid Grid.Column="1" Padding="15" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="5*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<TextBlock Text="Search Filter" FontSize="30" VerticalAlignment="Center" HorizontalAlignment="Left" />
<Grid Grid.Row="1">
</Grid>
<Grid Grid.Row="2">
<Button Content="DONE" Background="Yellow" VerticalAlignment="Center" HorizontalAlignment="Left" Click="Done_Button_Click" />
<Button Content="RESET" Background="Yellow" VerticalAlignment="Center" HorizontalAlignment="Right" />
</Grid>
</Grid>
</Grid>
</Grid>
代码背后:
private ObservableCollection<Wares> WaresCollection = new ObservableCollection<Wares>();
protected override void OnNavigatedTo(NavigationEventArgs e)
{
WaresCollection.Clear();
WaresCollection.Add(new Wares { WaresImage = "Assets/miao4.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao5.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao6.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao4.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao5.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao6.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao4.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao5.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao6.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao4.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao5.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao6.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao4.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao5.jpg" });
WaresCollection.Add(new Wares { WaresImage = "Assets/miao6.jpg" });
}
private void Image_Tapped(object sender, TappedRoutedEventArgs e)
{
FilterGrid.Visibility = Visibility.Visible;
}
private void Done_Button_Click(object sender, RoutedEventArgs e)
{
FilterGrid.Visibility = Visibility.Collapsed;
}
和Wares类:
public class Wares
{
public string WaresImage { get; set; }
}
以下是此演示的渲染图像:
内容总结
以上是互联网集市为您收集整理的c# – 如何在Windows 10 UWP中从屏幕右侧打开弹出窗口?全部内容,希望文章能够帮你解决c# – 如何在Windows 10 UWP中从屏幕右侧打开弹出窗口?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。