add basic code
This commit is contained in:
1 parent
6207684a79
commit
eb2779fa2a
9 files changed
+501
-1
No files matched your search
@@ -0,0 +1,274 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
[TemplatePart(Name = TabHeaderItemsControl, Type = typeof(ItemsControl))]
|
||||
public class Ribbon : Selector
|
||||
{
|
||||
private const string TabHeaderItemsControl = "PART_TabHeaderItemsControl";
|
||||
|
||||
private ItemsControl _tabHeaderItemsControl;
|
||||
|
||||
private readonly ObservableCollection<object> _tabHeaderItemsSource = new();
|
||||
|
||||
public Ribbon()
|
||||
{
|
||||
ItemContainerGenerator.StatusChanged += OnItemContainerGeneratorStatusChanged;
|
||||
|
||||
AddHandler(SelectableItem.SelectedEvent, new RoutedEventHandler(OnTabHeaderSelected));
|
||||
}
|
||||
|
||||
private void OnTabHeaderSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_tabHeaderItemsControl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.OriginalSource is not RibbonTabHeader tabHeader)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedIndex = _tabHeaderItemsControl.ItemContainerGenerator.IndexFromContainer(tabHeader);
|
||||
var currentSelectedIndex = SelectedIndex;
|
||||
|
||||
if (currentSelectedIndex < 0 || SelectedIndex != selectedIndex)
|
||||
{
|
||||
SelectedIndex = selectedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly DependencyPropertyKey SelectedContentPropertyKey =
|
||||
DependencyProperty.RegisterReadOnly("SelectedContent", typeof(object), typeof(Ribbon),
|
||||
new FrameworkPropertyMetadata((object) null));
|
||||
|
||||
public static readonly DependencyProperty SelectedContentProperty =
|
||||
SelectedContentPropertyKey.DependencyProperty;
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public object SelectedContent
|
||||
{
|
||||
get => GetValue(SelectedContentProperty);
|
||||
internal set => SetValue(SelectedContentPropertyKey, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsMinimizedProperty = DependencyProperty.Register(nameof(IsMinimized),
|
||||
typeof(bool), typeof(Ribbon),
|
||||
new PropertyMetadata(ValueBoxes.FalseBox, OnIsMinimizedChanged, CoerceIsMinimized));
|
||||
|
||||
private static object CoerceIsMinimized(DependencyObject d, object basevalue)
|
||||
{
|
||||
var num = (bool) basevalue ? 1 : 0;
|
||||
var ribbon = (Ribbon) d;
|
||||
return num != 0 && ribbon.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated ? ValueBoxes.FalseBox : basevalue;
|
||||
}
|
||||
|
||||
private static void OnIsMinimizedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool IsMinimized
|
||||
{
|
||||
get => (bool) GetValue(IsMinimizedProperty);
|
||||
set => SetValue(IsMinimizedProperty, ValueBoxes.BooleanBox(value));
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsDropDownOpenProperty =
|
||||
DependencyProperty.Register(nameof(IsDropDownOpen), typeof(bool), typeof(Ribbon),
|
||||
new PropertyMetadata(ValueBoxes.FalseBox, OnIsDropDownOpenChanged, CoerceIsDropDownOpen));
|
||||
|
||||
private static object CoerceIsDropDownOpen(DependencyObject d, object basevalue)
|
||||
{
|
||||
return ValueBoxes.FalseBox;
|
||||
}
|
||||
|
||||
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool IsDropDownOpen
|
||||
{
|
||||
get => (bool) GetValue(IsDropDownOpenProperty);
|
||||
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
_tabHeaderItemsControl = GetTemplateChild(TabHeaderItemsControl) as ItemsControl;
|
||||
if (_tabHeaderItemsControl is {ItemsSource: null})
|
||||
{
|
||||
_tabHeaderItemsControl.ItemsSource = _tabHeaderItemsSource;
|
||||
}
|
||||
|
||||
UpdateSelectedContent();
|
||||
}
|
||||
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
base.OnItemsChanged(e);
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Remove ||
|
||||
e.Action == NotifyCollectionChangedAction.Replace ||
|
||||
e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
InitializeSelection();
|
||||
}
|
||||
|
||||
if ((ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated || e.Action != NotifyCollectionChangedAction.Move) &&
|
||||
e.Action != NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshHeaderCollection();
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RibbonTab();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RibbonTab;
|
||||
|
||||
private void OnItemContainerGeneratorStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CoerceValue(Ribbon.IsMinimizedProperty);
|
||||
InitializeSelection();
|
||||
RefreshHeaderCollection();
|
||||
}
|
||||
|
||||
private int GetFirstVisibleTabIndex()
|
||||
{
|
||||
var count = Items.Count;
|
||||
for (var index = 0; index < count; ++index)
|
||||
{
|
||||
if (ItemContainerGenerator.ContainerFromIndex(index) is RibbonTab {IsVisible: true})
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void InitializeSelection()
|
||||
{
|
||||
if (SelectedIndex >= 0 || Items.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var firstVisibleTabIndex = GetFirstVisibleTabIndex();
|
||||
if (firstVisibleTabIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SelectedIndex = firstVisibleTabIndex;
|
||||
}
|
||||
|
||||
private static bool EqualsEx(object o1, object o2)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Equals(o1, o2);
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private RibbonTab GetSelectedRibbonTab()
|
||||
{
|
||||
var selectedItem = SelectedItem;
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (selectedItem is not RibbonTab ribbonTab)
|
||||
{
|
||||
ribbonTab = ItemContainerGenerator.ContainerFromIndex(SelectedIndex) as RibbonTab;
|
||||
|
||||
if (ribbonTab == null || !EqualsEx(selectedItem, ItemContainerGenerator.ItemFromContainer(ribbonTab)))
|
||||
{
|
||||
ribbonTab = ItemContainerGenerator.ContainerFromItem(selectedItem) as RibbonTab;
|
||||
}
|
||||
}
|
||||
|
||||
return ribbonTab;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void UpdateSelectedContent()
|
||||
{
|
||||
if (SelectedIndex < 0)
|
||||
{
|
||||
SelectedContent = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var ribbonTab = GetSelectedRibbonTab();
|
||||
if (ribbonTab == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var visualParent = VisualTreeHelper.GetParent(ribbonTab) as FrameworkElement;
|
||||
|
||||
//seitem
|
||||
}
|
||||
|
||||
private static object CreateDefaultHeaderObject() => new SingleSpaceObject();
|
||||
|
||||
private void RefreshHeaderCollection()
|
||||
{
|
||||
var itemsCount = Items.Count;
|
||||
for (var index = 0; index < itemsCount; ++index)
|
||||
{
|
||||
object header = null;
|
||||
if (ItemContainerGenerator.ContainerFromIndex(index) is RibbonTab ribbonTab)
|
||||
{
|
||||
header = ribbonTab.Header;
|
||||
}
|
||||
|
||||
header ??= CreateDefaultHeaderObject();
|
||||
|
||||
if (index >= _tabHeaderItemsSource.Count)
|
||||
{
|
||||
_tabHeaderItemsSource.Add(header);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tabHeaderItemsSource[index] = header;
|
||||
}
|
||||
}
|
||||
|
||||
var headerCount = _tabHeaderItemsSource.Count;
|
||||
for (var index = 0; index < headerCount - itemsCount; ++index)
|
||||
{
|
||||
_tabHeaderItemsSource.RemoveAt(itemsCount);
|
||||
}
|
||||
}
|
||||
|
||||
private class SingleSpaceObject
|
||||
{
|
||||
public override string ToString() => " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonGroup : HeaderedItemsControl
|
||||
{
|
||||
public static readonly DependencyProperty ShowLauncherButtonProperty = DependencyProperty.Register(
|
||||
"ShowLauncherButton", typeof(bool), typeof(RibbonGroup), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool ShowLauncherButton
|
||||
{
|
||||
get => (bool) GetValue(ShowLauncherButtonProperty);
|
||||
set => SetValue(ShowLauncherButtonProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowSplitterProperty = DependencyProperty.Register(
|
||||
"ShowSplitter", typeof(bool), typeof(RibbonGroup), new PropertyMetadata(ValueBoxes.TrueBox));
|
||||
|
||||
public bool ShowSplitter
|
||||
{
|
||||
get => (bool) GetValue(ShowSplitterProperty);
|
||||
set => SetValue(ShowSplitterProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonTab : HeaderedItemsControl
|
||||
{
|
||||
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
|
||||
"IsSelected", typeof(bool), typeof(RibbonTab), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => (bool) GetValue(IsSelectedProperty);
|
||||
set => SetValue(IsSelectedProperty, value);
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RibbonGroup();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RibbonGroup;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonTabHeader : SelectableItem
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonTabHeaderItemsControl : ItemsControl
|
||||
{
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RibbonTabHeader();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RibbonTabHeader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonTabHeadersPanel : SimpleStackPanel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,12 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\PropertyItem.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\PropertyItemsControl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\PropertyResolver.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\Ribbon.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonGroup.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTab.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTabHeader.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTabHeaderItemsControl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTabHeadersPanel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Screenshot\Screenshot.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Sprite.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\ToggleBlock.cs" />
|
||||
@@ -385,6 +391,9 @@
|
||||
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\ElementGroup.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Ribbon.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<None Include="$(MSBuildThisFileDirectory)Themes\XamlCombine.exe" />
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Basic\Colors\Colors.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<Geometry x:Key="NailGeometry">M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3-15.4 12.3-16.6 35.4-2.7 49.4l181.7 181.7-215.4 215.2c-2.6 2.6-4.3 6.1-4.6 9.8l-3.4 37.2c-0.9 9.4 6.6 17.4 15.9 17.4 0.5 0 1 0 1.5-0.1l37.2-3.4c3.7-0.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8z</Geometry>
|
||||
<Geometry x:Key="DialogBoxLauncherGeometry">M0,0 8,0 8,1 1,1 1,8 0,8 M 3.7,3 8,7.3 8,4 9,4 9,9 4,9 4,8 7.3,8 3,3.7</Geometry>
|
||||
|
||||
<Style TargetType="hc:RibbonGroup">
|
||||
<Setter Property="Height" Value="95"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Padding" Value="6"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonGroup">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ItemsPresenter Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}"/>
|
||||
<ContentPresenter Name="ContentPresenter" VerticalAlignment="Bottom" TextElement.Foreground="{DynamicResource SecondaryTextBrush}" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,2" ContentSource="Header" HorizontalAlignment="Center" Grid.Row="1"/>
|
||||
<Button Visibility="{Binding ShowLauncherButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,4,0" Grid.Column="1" Width="9" Height="9" Grid.Row="1" HorizontalAlignment="Right" Style="{StaticResource ButtonCustom}" hc:BackgroundSwitchElement.MouseHoverBackground="{DynamicResource SecondaryRegionBrush}">
|
||||
<Path Stretch="Uniform" Data="{StaticResource DialogBoxLauncherGeometry}" Fill="{DynamicResource SecondaryTextBrush}"/>
|
||||
</Button>
|
||||
<Border Visibility="{Binding ShowSplitter,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,4" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Width="1" Background="{TemplateBinding BorderBrush}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ShowLauncherButton" Value="True">
|
||||
<Setter TargetName="ContentPresenter" Property="Margin" Value="20,0,20,2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="hc:RibbonTabHeader">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="SelfManage" Value="True"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTabHeader">
|
||||
<hc:SimplePanel x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Border x:Name="BorderBottom" Visibility="{Binding IsSelected,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,2" Background="{TemplateBinding Background}" Margin="12,0,12,2"/>
|
||||
<ContentPresenter x:Name="ContentPresenter" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
</hc:SimplePanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="hc:RibbonTab">
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTab">
|
||||
<hc:SimplePanel>
|
||||
<Border x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,3" Background="{TemplateBinding Background}" Margin="0"/>
|
||||
<ItemsPresenter/>
|
||||
</hc:SimplePanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="hc:Ribbon">
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:Ribbon">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Margin="10,0" Grid.Row="1" Grid.ColumnSpan="2" Height="96" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" ShadowDepth="2" Direction="-90" Color="{StaticResource EffectShadowColor}" Opacity=".1" RenderingBias="Performance"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<hc:RibbonTabHeaderItemsControl Grid.Row="0" Grid.Column="0" x:Name="PART_TabHeaderItemsControl" Margin="10,0,10,2">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</hc:RibbonTabHeaderItemsControl>
|
||||
<ItemsPresenter Grid.Column="0" Grid.Row="1" Margin="10,0"/>
|
||||
<ToggleButton Margin="0,0,10,0" Padding="5" Width="20" Height="20" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource NailGeometry}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user