add Frame style
This commit is contained in:
1 parent
2544e84223
commit
ebde0bd42b
18 files changed
+192
No files matched your search
@@ -463,6 +463,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\frame_16xLG.png">
|
||||
<Link>Resources\Img\LeftMainContent\frame_16xLG.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
||||
|
||||
@@ -534,6 +534,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\frame_16xLG.png">
|
||||
<Link>Resources\Img\LeftMainContent\frame_16xLG.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
||||
|
||||
@@ -597,6 +597,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\OutlinedRectangleTool_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\frame_16xLG.png">
|
||||
<Link>Resources\Img\LeftMainContent\frame_16xLG.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
[ "ToolBar", "ToolBarDemoCtl", "ToolBar_16x", "" ],
|
||||
[ "Border", "BorderDemoCtl", "BorderElement_16x", "" ],
|
||||
[ "Label", "LabelDemoCtl", "Label_16x", "" ],
|
||||
[ "Frame", "FrameDemoCtl", "frame_16xLG", "1" ],
|
||||
[ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ]
|
||||
]
|
||||
},
|
||||
|
||||
@@ -296,6 +296,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\FlowDocumentDemoCtl.xaml.cs">
|
||||
<DependentUpon>FlowDocumentDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\FrameDemoCtl.xaml.cs">
|
||||
<DependentUpon>FrameDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
|
||||
<DependentUpon>GroupBoxDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -819,6 +822,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\FrameDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\GroupBoxDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -663,6 +663,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 导航框架 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Frame {
|
||||
get {
|
||||
return ResourceManager.GetString("Frame", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Gif图片 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -735,4 +735,7 @@
|
||||
<data name="OpenNavigationWindow" xml:space="preserve">
|
||||
<value>Open navigation window</value>
|
||||
</data>
|
||||
<data name="Frame" xml:space="preserve">
|
||||
<value>Frame</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -735,4 +735,7 @@
|
||||
<data name="OpenNavigationWindow" xml:space="preserve">
|
||||
<value>Open navigation window</value>
|
||||
</data>
|
||||
<data name="Frame" xml:space="preserve">
|
||||
<value>Frame</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -735,4 +735,7 @@
|
||||
<data name="OpenNavigationWindow" xml:space="preserve">
|
||||
<value>Open navigation window</value>
|
||||
</data>
|
||||
<data name="Frame" xml:space="preserve">
|
||||
<value>Frame</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -735,4 +735,7 @@
|
||||
<data name="OpenNavigationWindow" xml:space="preserve">
|
||||
<value>Open navigation window</value>
|
||||
</data>
|
||||
<data name="Frame" xml:space="preserve">
|
||||
<value>Frame</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -735,4 +735,7 @@
|
||||
<data name="OpenNavigationWindow" xml:space="preserve">
|
||||
<value>点击打开导航窗口</value>
|
||||
</data>
|
||||
<data name="Frame" xml:space="preserve">
|
||||
<value>导航框架</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 163 B |
@@ -0,0 +1,9 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.FrameDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<hc:TransitioningContentControl>
|
||||
<Frame Margin="32" Width="500" Height="360" Name="FrameDemo" NavigationUIVisibility="Visible"/>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class FrameDemoCtl
|
||||
{
|
||||
|
||||
private readonly List<Page> _pageList;
|
||||
|
||||
public FrameDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(Button_Click));
|
||||
|
||||
_pageList = new List<Page>();
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
_pageList.Add(CreatePage(i));
|
||||
}
|
||||
|
||||
FrameDemo.Navigate(_pageList[0]);
|
||||
}
|
||||
|
||||
private Page CreatePage(int index)
|
||||
{
|
||||
var indexStr = index.ToString();
|
||||
var button = new Button
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Content = indexStr,
|
||||
Width = 320,
|
||||
Tag = indexStr
|
||||
};
|
||||
|
||||
return new Page
|
||||
{
|
||||
Title = indexStr,
|
||||
Content = button
|
||||
};
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is Button button && button.Tag is string tag)
|
||||
{
|
||||
var index = tag.Value<int>() + 1;
|
||||
FrameDemo.Navigate(index >= _pageList.Count ? _pageList[0] : _pageList[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -398,6 +398,14 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\FrameBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Frame.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\NavigationWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
<ResourceDictionary Source="MenuBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="MenuItem4FrameStyle" BasedOn="{StaticResource MenuItemBaseStyle}" TargetType="MenuItem">
|
||||
<Setter Property="Header" Value="{Binding (JournalEntry.Name)}"/>
|
||||
<Setter Property="Command" Value="NavigationCommands.NavigateJournal"/>
|
||||
<Setter Property="CommandTarget" Value="{Binding TemplatedParent, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||||
<Setter Property="CommandParameter" Value="{Binding RelativeSource={RelativeSource Self}}"/>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="FrameWithNavigationUIStyle" TargetType="Frame">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter}, ConverterParameter='1,1,0,0'}" DockPanel.Dock="Top" BorderThickness="0,0,0,1" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource DarkDefaultBrush}">
|
||||
<controls:ButtonGroup x:Name="NavChrome" Width="90" Margin="10,6" HorizontalAlignment="Left">
|
||||
<Button Padding="6" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Command="NavigationCommands.BrowseBack">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu x:Name="BackNavMenu" ItemContainerStyle="{StaticResource MenuItem4FrameStyle}" ItemsSource="{Binding Path=(NavigationWindow.BackStack), RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<Button Padding="6" controls:IconElement.Geometry="{StaticResource RightGeometry}" Command="NavigationCommands.BrowseForward">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu x:Name="ForwardNavMenu" ItemContainerStyle="{StaticResource MenuItem4FrameStyle}" ItemsSource="{Binding Path=(NavigationWindow.ForwardStack), RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<Button Padding="6" controls:IconElement.Geometry="{StaticResource RotateRightGeometry}" Command="NavigationCommands.Refresh"/>
|
||||
</controls:ButtonGroup>
|
||||
</Border>
|
||||
<ContentPresenter x:Name="PART_NavWinCP" ClipToBounds="true"/>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="FrameBaseStyle" TargetType="Frame">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Frame">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter x:Name="PART_FrameCP"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="NavigationUIVisibility" Value="Visible">
|
||||
<Setter Property="Template" Value="{StaticResource FrameWithNavigationUIStyle}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="JournalOwnership" Value="OwnsJournal"/>
|
||||
<Condition Property="NavigationUIVisibility" Value="Automatic"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Template" Value="{StaticResource FrameWithNavigationUIStyle}"/>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,9 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/FrameBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource FrameBaseStyle}" TargetType="Frame"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -83,6 +83,7 @@
|
||||
<ResourceDictionary Source="StatusBar.xaml"/>
|
||||
<ResourceDictionary Source="FlowDocument.xaml"/>
|
||||
<ResourceDictionary Source="NavigationWindow.xaml"/>
|
||||
<ResourceDictionary Source="Frame.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user