如何做幻灯片在WPF。更改Windows的内容就像幻灯片幻灯片、就像、如何做、内容

2023-09-04 04:30:04 作者:因为有你俄可以为所欲为。

我要显示窗口,当用户点击一个按钮,然后显示在同一窗口他下一个内容。而且我想也做动画。可能吗?动画并不重要。 我只想更改内容dynamicaly 。我不能在任何地方找到它...

I want to display window and when user will click a button then show for him next content in the same window. And I want also to do a animation. Is it possible? Animation is not important. I only want to change content dynamicaly. I cant find it anywhere...

请给我simplier这个解决方案没有任何框架。

Please give me simplier solution for this without any frameworks.

的内容不只是图片。会有很多控制。

Content is not only images. There will be many controls.

我用 WPF 使用.NET框架4.0

I'm using WPF with .NET Framework 4.0

推荐答案

接近这一点没有大量的开销将是prepare幻灯片,用户控件的所有幻灯片,让主窗口的一个方法有一个

One way to approach this without a lot of overhead would be to prepare all slides of the slideshow as UserControls, let the main window have a

<ContentPresenter x:Name="CurrentSlidePresenter" />

和使用

UserControl currentSlide = GetCurrentSlide(); // implement this to your liking
CurrentSlidePresenter.Content = currentSlide;

在按钮单击处理程序。

此方法可以扩展使用用动画 FluidKit 。

This approach can be expanded to use animation using FluidKit.