Files
FluentTerminal/FluentTerminal.App/Views/MainPage.xaml
T
2020-03-01 13:04:26 +01:00

114 lines
5.7 KiB
XML

<Page
x:Class="FluentTerminal.App.Views.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:FluentTerminal.App.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="using:FluentTerminal.App.Views"
KeyDown="MainPage_OnKeyDown"
RequestedTheme="{x:Bind ViewModel.SelectedTerminal.TerminalTheme.Colors.Background, Mode=OneWay, Converter={StaticResource BackgroundToApplicationThemeConverter}}"
mc:Ignorable="d">
<Page.Background>
<SolidColorBrush Color="{ThemeResource SystemAccentColor}" />
</Page.Background>
<Page.Resources>
<converters:TerminalViewModelToViewConverter x:Key="TerminalViewModelToViewConverter" />
</Page.Resources>
<Grid x:Name="Root">
<Grid.Background>
<AcrylicBrush
AlwaysUseFallback="{x:Bind ViewModel.UseAcrylicBackground, Mode=OneWay, Converter={StaticResource NegateConverter}}"
BackgroundSource="HostBackdrop"
FallbackColor="{x:Bind ViewModel.SelectedTerminal.TerminalTheme.Colors.Background, Mode=OneWay}"
TintColor="{x:Bind ViewModel.SelectedTerminal.TerminalTheme.Colors.Background, Mode=OneWay}"
TintOpacity="{x:Bind ViewModel.BackgroundOpacity, Mode=OneWay}"
TintTransitionDuration="{x:Bind NoDuration}" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle x:Name="TitleBar" Fill="Transparent" />
<Grid
x:Name="TitleBarContents"
Height="{Binding CoreTitleBarHeight, Mode=OneWay}"
Margin="{Binding CoreTitleBarPadding, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Flyout="{x:Bind ViewModel.AppMenuViewModel, Mode=OneWay, Converter={StaticResource MenuViewModelToFlyoutMenuConverter}}" Style="{StaticResource TitleBarButtonStyle}">
<Button.Content>
<Viewbox Width="16" Height="16">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE700;" />
</Viewbox>
</Button.Content>
</Button>
<TextBlock
Grid.Column="1"
Margin="12,8,12,0"
IsHitTestVisible="False"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.WindowTitle, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap"
Visibility="{x:Bind ViewModel.ShowTabsOnTop, Mode=OneWay, Converter={StaticResource FalseToVisibleConverter}}" />
<Rectangle
x:Name="TabDropArea"
Grid.Column="1"
HorizontalAlignment="Stretch"
AllowDrop="True"
DragEnter="TabDropArea_DragEnter"
Drop="TabDropArea_Drop"
Fill="LightGray"
Opacity="0.2"
Visibility="{x:Bind DraggingHappensFromAnotherWindow, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}" />
<views:TabBar
x:Name="TopTabBar"
Grid.Column="1"
HorizontalAlignment="Left"
AddCommand="{x:Bind ViewModel.AddDefaultTabCommand}"
ItemsSource="{x:Bind ViewModel.Terminals, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SelectedTerminal, Mode=TwoWay}"
TabDraggedOutside="TabBar_TabDraggedOutside"
TabDraggingChanged="TabBar_TabDraggingChanged"
TabDraggingCompleted="TabBar_TabDraggingCompleted"
TabWindowChanged="TabView_Drop"
Visibility="{x:Bind ViewModel.ShowTabsOnTop, Mode=OneWay}" />
</Grid>
<ContentControl
x:Name="TerminalContainer"
Grid.Row="1"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{x:Bind ViewModel.SelectedTerminal, Mode=OneWay, Converter={StaticResource TerminalViewModelToViewConverter}}" />
<Rectangle
Grid.Row="1"
Fill="LightGray"
Opacity="0.01"
Visibility="{x:Bind DraggingHappens, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}" />
<Rectangle
Grid.Row="2"
HorizontalAlignment="Stretch"
AllowDrop="True"
DragEnter="TabDropArea_DragEnter"
Drop="TabDropArea_Drop"
Fill="LightGray"
Opacity="0.2"
Visibility="{x:Bind DraggingHappensFromAnotherWindow, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}" />
<views:TabBar
x:Name="BottomTabBar"
Grid.Row="2"
HorizontalAlignment="Left"
AddCommand="{x:Bind ViewModel.AddDefaultTabCommand}"
ItemsSource="{x:Bind ViewModel.Terminals, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SelectedTerminal, Mode=TwoWay}"
TabDraggedOutside="TabBar_TabDraggedOutside"
TabDraggingChanged="TabBar_TabDraggingChanged"
TabDraggingCompleted="TabBar_TabDraggingCompleted"
TabWindowChanged="TabView_Drop"
Visibility="{x:Bind ViewModel.ShowTabsOnBottom, Mode=OneWay}" />
</Grid>
</Page>