From ace8f5061299c0c9ada454abf115a1f496888829 Mon Sep 17 00:00:00 2001 From: Stephan Kieburg Date: Fri, 3 May 2024 15:19:58 +0200 Subject: [PATCH] Allow binding to Header and ContentTemplate of material:TabItem --- src/UraniumUI.Material/Controls/TabItem.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/UraniumUI.Material/Controls/TabItem.cs b/src/UraniumUI.Material/Controls/TabItem.cs index f324e74c..1b7c5218 100644 --- a/src/UraniumUI.Material/Controls/TabItem.cs +++ b/src/UraniumUI.Material/Controls/TabItem.cs @@ -9,11 +9,17 @@ public class TabItem : UraniumBindableObject public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(TabItem)); - public object Data { get; set; } - public DataTemplate ContentTemplate { get; set; } - public DataTemplate HeaderTemplate { get; set; } + public DataTemplate HeaderTemplate { get => (DataTemplate)GetValue(HeaderTemplateProperty); set => SetValue(HeaderTemplateProperty, value); } + + public static readonly BindableProperty HeaderTemplateProperty = BindableProperty.Create(nameof(HeaderTemplate), typeof(DataTemplate), typeof(TabItem), defaultBindingMode: BindingMode.TwoWay); + + public DataTemplate ContentTemplate { get => (DataTemplate)GetValue(ContentTemplateProperty); set => SetValue(ContentTemplateProperty, value); } + + public static readonly BindableProperty ContentTemplateProperty = BindableProperty.Create(nameof(ContentTemplate), typeof(DataTemplate), typeof(TabItem), defaultBindingMode: BindingMode.TwoWay); + public View Content { get; set; } public View Header { get; set; } + public object Data { get; set; } public TabView TabView { get; internal set; } public bool IsSelected { get => TabView.SelectedTab == this || (TabView.CurrentItem != null && TabView.CurrentItem == Data); }