diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index 7b30951d61..d0a746f87d 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -11,7 +11,6 @@ - diff --git a/src/Avalonia.Controls/ContentControl.cs b/src/Avalonia.Controls/ContentControl.cs index f5e2c14f39..20ec581108 100644 --- a/src/Avalonia.Controls/ContentControl.cs +++ b/src/Avalonia.Controls/ContentControl.cs @@ -67,7 +67,7 @@ namespace Avalonia.Controls { get { return GetValue(ContentTemplateProperty); } set { SetValue(ContentTemplateProperty, value); } - } + } /// /// Gets the presenter from the control's template. @@ -102,4 +102,4 @@ namespace Avalonia.Controls Presenter = presenter; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Generators/TabItemContainerGenerator.cs b/src/Avalonia.Controls/Generators/TabItemContainerGenerator.cs index 75788e393f..088f9e30ea 100644 --- a/src/Avalonia.Controls/Generators/TabItemContainerGenerator.cs +++ b/src/Avalonia.Controls/Generators/TabItemContainerGenerator.cs @@ -1,10 +1,10 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -namespace Avalonia.Controls.Generators -{ - using Avalonia.Controls.Primitives; +using Avalonia.Controls.Primitives; +namespace Avalonia.Controls.Generators +{ public class TabItemContainerGenerator : ItemContainerGenerator { public TabItemContainerGenerator(TabControl owner) @@ -30,10 +30,7 @@ namespace Avalonia.Controls.Generators { if (item is IHeadered headered) { - if (tabItem.Header != headered.Header) - { - tabItem.Header = headered.Header; - } + tabItem.Header = headered.Header; } else { @@ -50,9 +47,9 @@ namespace Avalonia.Controls.Generators } if (tabItem.Content == null) - { + { tabItem[~ContentControl.ContentProperty] = tabItem[~StyledElement.DataContextProperty]; - } + } return tabItem; } diff --git a/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs b/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs index b0517c23f1..7a46e0f776 100644 --- a/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs +++ b/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs @@ -32,7 +32,7 @@ namespace Avalonia.Controls.Primitives } /// - /// Gets or sets the data template used to display the content of the control. + /// Gets or sets the data template used to display the header content of the control. /// public IDataTemplate HeaderTemplate { diff --git a/src/Avalonia.Controls/TabControl.cs b/src/Avalonia.Controls/TabControl.cs index f81e1560c2..bf57133120 100644 --- a/src/Avalonia.Controls/TabControl.cs +++ b/src/Avalonia.Controls/TabControl.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; - using Avalonia.Controls.Generators; using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; @@ -92,7 +90,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the tabstrip placement of the tabcontrol. + /// Gets or sets the tabstrip placement of the TabControl. /// public Dock TabStripPlacement { @@ -101,7 +99,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the data template used to display the content of the control. + /// Gets or sets the default data template used to display the content of the selected tab. /// public IDataTemplate ContentTemplate { @@ -110,10 +108,10 @@ namespace Avalonia.Controls } /// - /// Gets or sets the currently selected content. + /// Gets or sets the content of the selected tab. /// /// - /// The content of the selected. + /// The content of the selected tab. /// public object SelectedContent { @@ -122,10 +120,10 @@ namespace Avalonia.Controls } /// - /// Gets or sets the template for the currently selected content. + /// Gets or sets the content template for the selected tab. /// /// - /// The selected content template. + /// The content template of the selected tab. /// public IDataTemplate SelectedContentTemplate { @@ -142,19 +140,9 @@ namespace Avalonia.Controls { base.OnTemplateApplied(e); - ItemsPresenterPart = e.NameScope.Find("PART_ItemsPresenter"); - - if (ItemsPresenterPart == null) - { - throw new NotSupportedException("ItemsPresenter not found."); - } + ItemsPresenterPart = e.NameScope.Get("PART_ItemsPresenter"); - ContentPart = e.NameScope.Find("PART_Content"); - - if (ContentPart == null) - { - throw new NotSupportedException("ContentPresenter not found."); - } + ContentPart = e.NameScope.Get("PART_Content"); } /// diff --git a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj index af1899bab1..638aba4d69 100644 --- a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj +++ b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj @@ -13,11 +13,6 @@ - - - - MSBuild:Compile - diff --git a/src/Avalonia.Themes.Default/TabControl.xaml b/src/Avalonia.Themes.Default/TabControl.xaml index e551b2e841..969887b38e 100644 --- a/src/Avalonia.Themes.Default/TabControl.xaml +++ b/src/Avalonia.Themes.Default/TabControl.xaml @@ -2,7 +2,6 @@