自定義WPF Page類我想創建一個自定義WPF頁類,我的所有網頁的派生自:使用並宣佈在XAML
public class CustomPage : Page
{
// custom dependency props here...
}
我不明白怎麼然後創建一個新的頁面在我的Visual Studio項目中,然後讓它使用自定義頁面類型。問題是Page的XAML中的根元素。我如何申報?這是行不通的:
<local:CustomPage
xmlns:local="clr-namespace:MyProject"
x:Class="KinectLevelUp.CustomSwipe.Views.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<Grid>
<!-- page content here... -->
</Grid>
</local:CustomPage>
我相信我只是不明白如何限定在根元素級的CustomPage類型。
你會得到什麼錯誤? – SLaks