Skip to content

Commit

Permalink
Fixed window buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
d2dyno1 committed Mar 11, 2022
1 parent 7ac5ce5 commit 4fad4a9
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 154 deletions.
5 changes: 5 additions & 0 deletions SecureFolderFS.WinUI/UserControls/TitleBarControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
<StackPanel
Height="32"
Padding="14,6"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
IsHitTestVisible="True"
Orientation="Horizontal"
Spacing="12">

<StackPanel.BackgroundTransition>
<BrushTransition />
</StackPanel.BackgroundTransition>

<!-- App icon -->
<Image
Width="16"
Expand Down
308 changes: 154 additions & 154 deletions SecureFolderFS.WinUI/Views/MainWindowHostPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<vc:BooleanToStringConverter x:Key="BooleanToStringConverter" />
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
Expand All @@ -35,160 +35,160 @@
x:FieldModifier="public" />

<!-- Main Content -->
<NavigationView
x:Name="Sidebar"
Grid.Row="1"
IsBackButtonVisible="Collapsed"
IsPaneToggleButtonVisible="True"
IsSettingsVisible="False"
MenuItemsSource="{x:Bind ViewModel.SidebarViewModel.SidebarItems}"
PaneTitle="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay, Converter={StaticResource BooleanToStringConverter}, ConverterParameter='false:STANDARD|:true:LOCALIZE|My vaults'}"
SelectionChanged="Sidebar_SelectionChanged">

<uc:NavigationControl PageViewModel="{x:Bind ViewModel.ActivePageViewModel, Mode=TwoWay}" />

<NavigationView.AutoSuggestBox>
<AutoSuggestBox
PlaceholderText="Search"
QueryIcon="Find"
Text="{x:Bind ViewModel.SidebarViewModel.SearchQuery, Mode=TwoWay}" />
</NavigationView.AutoSuggestBox>

<NavigationView.PaneCustomContent>
<Grid>
<Grid x:Name="CustomContent" x:Load="{x:Bind ViewModel.SidebarViewModel.NoItemsFoundLoad, Mode=OneWay}">
<TextBlock
HorizontalAlignment="Center"
<Grid Grid.Row="1" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<NavigationView
x:Name="Sidebar"
Grid.Row="1"
IsBackButtonVisible="Collapsed"
IsPaneToggleButtonVisible="True"
IsSettingsVisible="False"
MenuItemsSource="{x:Bind ViewModel.SidebarViewModel.SidebarItems}"
PaneTitle="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay, Converter={StaticResource BooleanToStringConverter}, ConverterParameter='false:STANDARD|:true:LOCALIZE|My vaults'}"
SelectionChanged="Sidebar_SelectionChanged">

<uc:NavigationControl PageViewModel="{x:Bind ViewModel.ActivePageViewModel, Mode=TwoWay}" />

<NavigationView.AutoSuggestBox>
<AutoSuggestBox
PlaceholderText="Search"
QueryIcon="Find"
Text="{x:Bind ViewModel.SidebarViewModel.SearchQuery, Mode=TwoWay}" />
</NavigationView.AutoSuggestBox>

<NavigationView.PaneCustomContent>
<Grid>
<Grid x:Name="CustomContent" x:Load="{x:Bind ViewModel.SidebarViewModel.NoItemsFoundLoad, Mode=OneWay}">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="No vaults found" />
</Grid>
</Grid>
</NavigationView.PaneCustomContent>

<NavigationView.PaneFooter>
<Grid
Width="{Binding Path=OpenPaneLength, ElementName=Sidebar}"
Padding="20,0,20,12"
HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="No vaults found" />
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{x:Bind ViewModel.SidebarViewModel.CreateNewVaultCommand}"
Style="{ThemeResource AccentButtonStyle}"
Visibility="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="8">
<FontIcon
Margin="0,0,0,-2"
FontSize="16"
Glyph="&#xECC8;" />
<TextBlock Text="New vault" />
</StackPanel>
</Button>
<Button
Grid.Column="0"
Height="36"
Margin="-16,16,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{x:Bind ViewModel.SidebarViewModel.CreateNewVaultCommand}"
Style="{ThemeResource AccentButtonStyle}"
Visibility="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter='invert'}">
<FontIcon FontSize="16" Glyph="&#xECC8;" />
</Button>

<Button
Grid.Column="1"
Width="36"
Height="36"
Padding="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Command="{x:Bind ViewModel.SidebarViewModel.OpenSettingsCommand}"
IsEnabled="False"
Visibility="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay}">
<AnimatedIcon>
<AnimatedIcon.Source>
<animvis:AnimatedSettingsVisualSource />
</AnimatedIcon.Source>
<AnimatedIcon.FallbackIconSource>
<SymbolIconSource Symbol="Setting" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
</Button>
</Grid>
</Grid>
</NavigationView.PaneCustomContent>

<NavigationView.PaneFooter>
<Grid
Width="{Binding Path=OpenPaneLength, ElementName=Sidebar}"
Padding="20,0,20,12"
HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{x:Bind ViewModel.SidebarViewModel.CreateNewVaultCommand}"
Style="{ThemeResource AccentButtonStyle}"
Visibility="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="8">
<FontIcon
Margin="0,0,0,-2"
FontSize="16"
Glyph="&#xECC8;" />
<TextBlock Text="New vault" />
</StackPanel>
</Button>
<Button
Grid.Column="0"
Height="36"
Margin="-16,16,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{x:Bind ViewModel.SidebarViewModel.CreateNewVaultCommand}"
Style="{ThemeResource AccentButtonStyle}"
Visibility="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter='invert'}">
<FontIcon FontSize="16" Glyph="&#xECC8;" />
</Button>

<Button
Grid.Column="1"
Width="36"
Height="36"
Padding="8"
HorizontalAlignment="Right"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Command="{x:Bind ViewModel.SidebarViewModel.OpenSettingsCommand}"
IsEnabled="False"
Visibility="{x:Bind Sidebar.IsPaneOpen, Mode=OneWay}">
<AnimatedIcon>
<AnimatedIcon.Source>
<animvis:AnimatedSettingsVisualSource />
</AnimatedIcon.Source>
<AnimatedIcon.FallbackIconSource>
<SymbolIconSource Symbol="Setting" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
</Button>
</Grid>
</NavigationView.PaneFooter>

<NavigationView.MenuItemTemplate>
<DataTemplate x:DataType="vm:SidebarItemViewModel">
<NavigationViewItem
Height="64"
AutomationProperties.Name="{x:Bind VaultName, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind VaultName, Mode=OneWay}">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xF540;" />
</NavigationViewItem.Icon>
<NavigationViewItem.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!-- Vault name -->
<TextBlock
Grid.Row="0"
Grid.Column="0"
FontWeight="SemiBold"
Text="{x:Bind VaultName, Mode=OneWay}" />

<!-- Last opened -->
<TextBlock
Grid.Row="1"
Grid.Column="0"
FontSize="14"
Opacity="0.8"
Text="{x:Bind VaultViewModel.VaultModel.LastOpened, Mode=OneWay, Converter={StaticResource DateTimeToStringConverter}}" />
</Grid>
</NavigationViewItem.Content>
<NavigationViewItem.ContextFlyout>
<MenuFlyout>
<!-- TODO: Determine the description and icon and update the item: "Show in Files" -->
<MenuFlyoutItem Command="{x:Bind ShowInFileExplorerCommand}" Text="Show encrypted vault in File Explorer">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xED25;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>

<MenuFlyoutItem Command="{x:Bind RemoveVaultCommand}" Text="Remove vault from the list">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE738;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</NavigationViewItem.ContextFlyout>
</NavigationViewItem>
</DataTemplate>
</NavigationView.MenuItemTemplate>
</NavigationView>


</NavigationView.PaneFooter>

<NavigationView.MenuItemTemplate>
<DataTemplate x:DataType="vm:SidebarItemViewModel">
<NavigationViewItem
Height="64"
AutomationProperties.Name="{x:Bind VaultName, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind VaultName, Mode=OneWay}">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xF540;" />
</NavigationViewItem.Icon>
<NavigationViewItem.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!-- Vault name -->
<TextBlock
Grid.Row="0"
Grid.Column="0"
FontWeight="SemiBold"
Text="{x:Bind VaultName, Mode=OneWay}" />

<!-- Last opened -->
<TextBlock
Grid.Row="1"
Grid.Column="0"
FontSize="14"
Opacity="0.8"
Text="{x:Bind VaultViewModel.VaultModel.LastOpened, Mode=OneWay, Converter={StaticResource DateTimeToStringConverter}}" />
</Grid>
</NavigationViewItem.Content>
<NavigationViewItem.ContextFlyout>
<MenuFlyout>
<!-- TODO: Determine the description and icon and update the item: "Show in Files" -->
<MenuFlyoutItem Command="{x:Bind ShowInFileExplorerCommand}" Text="Show encrypted vault in File Explorer">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xED25;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>

<MenuFlyoutItem Command="{x:Bind RemoveVaultCommand}" Text="Remove vault from the list">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE738;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</NavigationViewItem.ContextFlyout>
</NavigationViewItem>
</DataTemplate>
</NavigationView.MenuItemTemplate>
</NavigationView>
</Grid>
</Grid>
</Page>
1 change: 1 addition & 0 deletions SecureFolderFS.WinUI/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private void EnsureEarlyWindow()
{
this.ExtendsContentIntoTitleBar = true;
SetTitleBar(HostPage.CustomTitleBar);
HostPage.CustomTitleBar.Margin = new Thickness(0, 0, 138, 0); // Don't cover up Window buttons
}

// Register ThemeHelper
Expand Down

0 comments on commit 4fad4a9

Please sign in to comment.