一、自定义窗体基类只能有.cs文件,不能包含.xaml文件...

public class BaseWindow01: Window
{
  public Window2()
  {
    this.AllowsTransparency = true;
    this.WindowStyle = System.Windows.WindowStyle.None;
    this.ResizeMode = System.Windows.ResizeMode.NoResize;
    this.Background = null;

  }
}

 

二、继承自定义窗体的.cs文件

public class MainWindow : BaseWindow01{}

 

三、继承自定以窗体的.xaml文件里,声明xmlns:src

<src:BaseWindow01 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

                x:Class="Demo01.MainWindow"

                xmlns:src="clr-namespace:Demo01"

                Height="640"

                Width="480">

    <Grid/>

</src:BaseWindow01 >

相关文章:

  • 2022-12-23
  • 2022-01-22
  • 2021-09-24
  • 2021-07-22
  • 2022-12-23
  • 2021-10-27
  • 2021-05-26
猜你喜欢
  • 2021-06-09
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2021-06-14
相关资源
相似解决方案