简体   繁体   English

我应该使用哪种WPF布局和控件来实现故事板效果

[英]Which WPF Layout and Controls Should I Use for a Storyboard Effect

I want to create a layout that has small panels at the top and bottom and then a main panel in the center that fills the remainder of the window. 我想创建一个在顶部和底部有小面板的布局,然后在中心填充窗口其余部分的主面板。 The main window should have the functionality of a tab panel but instead of simple tabs I want the tab pages to slide on and off the screen. 主窗口应该具有选项卡面板的功能,但不是简单的选项卡,我希望选项卡页面可以在屏幕上和从屏幕上滑动。 It will be like one large storyboard that slides back and forth and only displays one scene at a time. 它就像一个大型的故事板来回滑动,一次只显示一个场景。

So lets assume there are 4 tab pages. 所以我们假设有4个标签页。 Initially the first page will be visible, the 2nd page will be directly off the screen to the right, the 3rd page will be 2 pages off the screen to the right and the 4th page will be 3 pages off the screen to the right. 最初第一页将是可见的,第二页将直接在屏幕右侧,第三页将是屏幕右侧的2页,第四页将是屏幕右侧的3页。 When the user clicks to see the 3rd tab page the layout will slide left 2 pages. 当用户单击以查看第3个标签页时,布局将向左滑动2页。 Then if the user clicks to see page 1 again, the page will slide back right 2 pages. 然后,如果用户再次单击以查看第1页,则该页面将向右滑动2页。

The window needs to be resizeable, so I can't use fixed sizes and offset. 窗口需要调整大小,所以我不能使用固定大小和偏移量。

Do I just need to use a StackPanel and programmatically set width, height, and position or is there something built-in that I can use? 我只需要使用StackPanel并以编程方式设置宽度,高度和位置,还是有内置的东西可以使用?

Hrrrm the first idea that comes to mind is use a ScrollViewer and hide the ScrollBars . Hrrrm首先想到的是使用ScrollViewer并隐藏ScrollBars

You could then display all your items in a StackPanel in the ScrollViewer , and when you want to scroll an item into view, simply animate the ScrollViewer's position so it smoothly scrolls to the specified item. 然后,您可以在ScrollViewer中的StackPanel中显示所有项目,当您想要将项目滚动到视图中时,只需为ScrollViewer的位置设置动画,以便它可以平滑地滚动到指定的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM