"CustomWindowDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CustomWindowDemo"
mc:Ignorable="d" MouseMove="Window_MouseMove"
WindowStyle="None" AllowsTransparency="True" BorderBrush="Orange" BorderThickness="3,0,3,3"
Title="MainWindow"300"525">
40">*">80">"0" Background="Orange">
"20,5,5,5" Foreground="Red" Text="TestWindow" FOntSize="14" VerticalAlignment="Center"/>
"20,30" FOntSize="16" Text="This is a Test Window of customized." Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center">"2" Orientation="Horizontal" HorizOntalAlignment="Center">
后台代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CustomWindowDemo
{
////// MainWindow.xaml 的交互逻辑
///publicpartialclass MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
privatevoid Confirm_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
privatevoid Cancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
privatevoidWindow_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
//Window.DragMove(); }
}
}
}