我正在重建一個在downloadable code for this WPF video中找到的WPF幻燈片應用程序結構。將Pages或UserControl加載到XAML Frame Element中有什麼區別?
有一個Presentation類,它有一個INotifyPropertyChanged屬性「CurrentSlide」,當你點擊下一個/上一個按鈕時該屬性發生變化,並在Frame元素中動態顯示。
下載的代碼加載頁面到這個框架,但我加載用戶控件這似乎很好的工作,其實我找不到任何區別實驗。
有誰知道在加載頁面或用戶控件的任何差異爲XAML框架單元?
<Window x:Class="TestFull8229.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:TestFull8229.Commands"
xmlns:viewModels="clr-namespace:TestFull8229.ViewModels"
Title="Main Window" Height="400" Width="800">
<Window.Resources>
<viewModels:Presentation x:Key="presentation"/>
</Window.Resources>
<DockPanel>
<StackPanel>
<Viewbox Stretch="Uniform">
<Frame Width="800" Height="600"
Source="{Binding Path=CurrentSlide,
Source={StaticResource presentation}}"/>
</Viewbox>
</StackPanel>
</DockPanel>
</Window>
是的,我在主的.xaml文件讀出加載的頁面,其中一個用戶控件不具備的Title屬性的代碼已經找到,所以這是一個原因,在這個例子中使用的頁面至少 – 2009-05-18 09:58:54