16 changed files with 159 additions and 5 deletions
@ -0,0 +1,15 @@ |
|||||
|
<Style xmlns="https://github.com/perspex" Selector="TabControl"> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<Grid RowDefinitions="Auto,*"> |
||||
|
<TabStrip Items="{TemplateBinding Items}" |
||||
|
SelectedIndex="{TemplateBinding Path=SelectedIndex, Mode=TwoWay}"/> |
||||
|
<Carousel Items="{TemplateBinding Items}" |
||||
|
MemberSelector="Content" |
||||
|
SelectedIndex="{TemplateBinding Path=SelectedIndex}" |
||||
|
Transition="{TemplateBinding Transition}" |
||||
|
Grid.Row="1"/> |
||||
|
</Grid> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
@ -0,0 +1,14 @@ |
|||||
|
<Styles xmlns="https://github.com/perspex"> |
||||
|
<Style Selector="TabItem"> |
||||
|
<Setter Property="FontSize" Value="16"/> |
||||
|
<Setter Property="Foreground" Value="Gray"/> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<ContentPresenter Name="PART_HeaderPresenter" Content="{TemplateBinding Header}"/> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="TabItem:selected"> |
||||
|
<Setter Property="Foreground" Value="Black"/> |
||||
|
</Style> |
||||
|
</Styles> |
||||
@ -0,0 +1,14 @@ |
|||||
|
<Styles xmlns="https://github.com/perspex"> |
||||
|
<Style Selector="TabStrip"> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<ItemsPresenter Items="{TemplateBinding Items}" |
||||
|
ItemsPanel="{TemplateBinding ItemsPanel}"/> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="TabStrip /template/ StackPanel"> |
||||
|
<Setter Property="Gap" Value="16"/> |
||||
|
<Setter Property="Orientation" Value="Horizontal"/> |
||||
|
</Style> |
||||
|
</Styles> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<Style xmlns="https://github.com/perspex" Selector="Window"> |
||||
|
<Setter Property="FontFamily" Value="Segoe UI"/> |
||||
|
<Setter Property="FontSize" Value="12"/> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<Border Background="{TemplateBinding Background}"> |
||||
|
<AdornerDecorator> |
||||
|
<ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/> |
||||
|
</AdornerDecorator> |
||||
|
</Border> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
@ -0,0 +1,36 @@ |
|||||
|
// Copyright (c) The Perspex Project. All rights reserved.
|
||||
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
|
||||
|
using System; |
||||
|
using System.Globalization; |
||||
|
using OmniXaml.TypeConversion; |
||||
|
using Perspex.Markup.Xaml.Templates; |
||||
|
|
||||
|
namespace Perspex.Markup.Xaml.Converters |
||||
|
{ |
||||
|
public class MemberSelectorTypeConverter : ITypeConverter |
||||
|
{ |
||||
|
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) |
||||
|
{ |
||||
|
return sourceType == typeof(string); |
||||
|
} |
||||
|
|
||||
|
public bool CanConvertTo(IXamlTypeConverterContext context, Type destinationType) |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
public object ConvertFrom(IXamlTypeConverterContext context, CultureInfo culture, object value) |
||||
|
{ |
||||
|
return new MemberSelector |
||||
|
{ |
||||
|
MemberName = (string)value, |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public object ConvertTo(IXamlTypeConverterContext context, CultureInfo culture, object value, Type destinationType) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
// Copyright (c) The Perspex Project. All rights reserved.
|
||||
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
|
||||
|
using System.Reflection; |
||||
|
using Perspex.Controls.Templates; |
||||
|
|
||||
|
namespace Perspex.Markup.Xaml.Templates |
||||
|
{ |
||||
|
public class MemberSelector : IMemberSelector |
||||
|
{ |
||||
|
public string MemberName { get; set; } |
||||
|
|
||||
|
public object Select(object o) |
||||
|
{ |
||||
|
// TODO: Handle nested property paths, changing values etc.
|
||||
|
var property = o.GetType().GetRuntimeProperty(MemberName); |
||||
|
|
||||
|
if (property != null) |
||||
|
{ |
||||
|
return property.GetValue(o); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue