标签:
baseWin不能有XAML文件,只能是一个类
namespace WPFStudy
{
public class MyBaseWin : Window
{
public MyBaseWin(int w, int h, String title) {
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
this.Width = w;
this.Height = h;
this.Title = title;
this.FontSize = 50;
}
}
}
public partial class WinTest : MyBaseWin
{
public WinTest(int w,int h,String title):base(w,h,title)
{
InitializeComponent();
}
}
public partial class WinTest : WPFStudy.MyBaseWin, System.Windows.Markup.IComponentConnector {
<my:MyBaseWin x:Class="WPFStudy.WinTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:my="clr-namespace:WPFStudy"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
>
<Grid>
<Label Content="test"></Label>
<Button Content="测试"></Button>
</Grid>
</my:MyBaseWin>
标签:
原文地址:http://www.cnblogs.com/ahaobest/p/4475057.html