如何在标题栏中添加图像?

标题栏中的图标太小,所以我想添加Image而不是Icon。

如果你不喜欢使用这个图标,那么单一的方法就是制作一个自定义标题栏,我想……

您可以使用此代码:这是XAML代码:

                  

这是C#代码:

 using System; using System.Collections.Generic; using System.Linq; using System.Text; 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 WpfApplication1 { ///  /// Interaction logic for MainWindow.xaml ///  public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { this.Close(); } private void button2_Click(object sender, RoutedEventArgs e) { if (this.WindowState == WindowState.Maximized) this.WindowState = WindowState.Normal; else this.WindowState = WindowState.Maximized; } private void button3_Click(object sender, RoutedEventArgs e) { this.WindowState = WindowState.Minimized; } private void rectangle1_MouseDown(object sender, MouseButtonEventArgs e) { DragMove(); } } }