mirror of
https://github.com/kwsch/pkNX.git
synced 2026-05-23 13:06:16 -05:00
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace pkNX.WinForms;
|
|
|
|
public class WindowItem : TabItem
|
|
{
|
|
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(
|
|
"Title", typeof(string), typeof(WindowItem),
|
|
new PropertyMetadata("Test", OnTitlePropertyChanged));
|
|
|
|
private static void OnTitlePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
var title = (string)d.GetValue(TitleProperty);
|
|
|
|
if (title == null)
|
|
return;
|
|
|
|
d.SetValue(HeaderProperty, new ClosableHeader(title));
|
|
}
|
|
|
|
public string Title
|
|
{
|
|
get { return (string)GetValue(TitleProperty); }
|
|
set { SetValue(TitleProperty, value); }
|
|
}
|
|
|
|
public WindowItem()
|
|
{
|
|
Header = new ClosableHeader();
|
|
}
|
|
}
|
|
|
|
|
|
public partial class DockableWindow : UserControl
|
|
{
|
|
[System.ComponentModel.Bindable(true)]
|
|
public ObservableCollection<WindowItem> Windows { get; set; } = new ObservableCollection<WindowItem>();
|
|
|
|
|
|
protected override void OnInitialized(EventArgs e)
|
|
{
|
|
base.OnInitialized(e);
|
|
|
|
TabControl tabControl = new TabControl
|
|
{
|
|
ItemsSource = Windows
|
|
};
|
|
|
|
Content = tabControl;
|
|
}
|
|
}
|