自定义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