Browse Source

Minor fixes

pull/1842/head
Benedikt Schroeder 7 years ago
parent
commit
f8b196a39b
  1. 1
      samples/ControlCatalog/ControlCatalog.csproj
  2. 4
      src/Avalonia.Controls/ContentControl.cs
  3. 15
      src/Avalonia.Controls/Generators/TabItemContainerGenerator.cs
  4. 2
      src/Avalonia.Controls/Primitives/HeaderedContentControl.cs
  5. 28
      src/Avalonia.Controls/TabControl.cs
  6. 5
      src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj
  7. 1
      src/Avalonia.Themes.Default/TabControl.xaml

1
samples/ControlCatalog/ControlCatalog.csproj

@ -11,7 +11,6 @@
</EmbeddedResource>
<EmbeddedResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\Fonts\SourceSansPro-Bold.ttf" />
<EmbeddedResource Include="Assets\Fonts\SourceSansPro-BoldItalic.ttf" />

4
src/Avalonia.Controls/ContentControl.cs

@ -67,7 +67,7 @@ namespace Avalonia.Controls
{
get { return GetValue(ContentTemplateProperty); }
set { SetValue(ContentTemplateProperty, value); }
}
}
/// <summary>
/// Gets the presenter from the control's template.
@ -102,4 +102,4 @@ namespace Avalonia.Controls
Presenter = presenter;
}
}
}
}

15
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<TabItem>
{
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;
}

2
src/Avalonia.Controls/Primitives/HeaderedContentControl.cs

@ -32,7 +32,7 @@ namespace Avalonia.Controls.Primitives
}
/// <summary>
/// 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.
/// </summary>
public IDataTemplate HeaderTemplate
{

28
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
}
/// <summary>
/// Gets or sets the tabstrip placement of the tabcontrol.
/// Gets or sets the tabstrip placement of the TabControl.
/// </summary>
public Dock TabStripPlacement
{
@ -101,7 +99,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// 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.
/// </summary>
public IDataTemplate ContentTemplate
{
@ -110,10 +108,10 @@ namespace Avalonia.Controls
}
/// <summary>
/// Gets or sets the currently selected content.
/// Gets or sets the content of the selected tab.
/// </summary>
/// <value>
/// The content of the selected.
/// The content of the selected tab.
/// </value>
public object SelectedContent
{
@ -122,10 +120,10 @@ namespace Avalonia.Controls
}
/// <summary>
/// Gets or sets the template for the currently selected content.
/// Gets or sets the content template for the selected tab.
/// </summary>
/// <value>
/// The selected content template.
/// The content template of the selected tab.
/// </value>
public IDataTemplate SelectedContentTemplate
{
@ -142,19 +140,9 @@ namespace Avalonia.Controls
{
base.OnTemplateApplied(e);
ItemsPresenterPart = e.NameScope.Find<ItemsPresenter>("PART_ItemsPresenter");
if (ItemsPresenterPart == null)
{
throw new NotSupportedException("ItemsPresenter not found.");
}
ItemsPresenterPart = e.NameScope.Get<ItemsPresenter>("PART_ItemsPresenter");
ContentPart = e.NameScope.Find<ContentPresenter>("PART_Content");
if (ContentPart == null)
{
throw new NotSupportedException("ContentPresenter not found.");
}
ContentPart = e.NameScope.Get<ContentPresenter>("PART_Content");
}
/// <inheritdoc/>

5
src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj

@ -13,11 +13,6 @@
<ProjectReference Include="..\Avalonia.Layout\Avalonia.Layout.csproj" />
<ProjectReference Include="..\Avalonia.Visuals\Avalonia.Visuals.csproj" />
<ProjectReference Include="..\Avalonia.Styling\Avalonia.Styling.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="TabItem.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
</ItemGroup>
<Import Project="..\..\build\EmbedXaml.props" />
<Import Project="..\..\build\Rx.props" />

1
src/Avalonia.Themes.Default/TabControl.xaml

@ -2,7 +2,6 @@
<Style Selector="TabControl">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>

Loading…
Cancel
Save