/
hlebusheck
/
notes
Обзор
Документация
Войти
/
hlebusheck
/
notes
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
Notes.Wpf/Controls/Behaviors/WindowBarBehavior.cs
30 строк
949 B
Hlebusheck
Рефакторинг
03 дек 2022, 18:27
03 дек 2022, 18:27
9e9ec0e
Код
Авторство
О чём код?
using Microsoft.Xaml.Behaviors; using System.Windows; namespace Notes.Controls.Behaviors { class WindowBarBehavior : Behavior<Window> { public UIElement? TopBar { get; set; } protected override void OnAttached() { base.OnAttached(); SetTopBar(AssociatedObject, TopBar); } public static readonly DependencyProperty AttachedTopBarProperty = DependencyProperty.RegisterAttached( "AttachedTopBar", typeof(UIElement), typeof(WindowBarBehavior), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits)); public static UIElement GetTopBar(UIElement target) => (UIElement)target.GetValue(AttachedTopBarProperty); public static void SetTopBar(UIElement target, UIElement? value) => target.SetValue(AttachedTopBarProperty, value); } }