Skip to content

Commit

Permalink
Updated control panel LivelyProperties menu to the new design
Browse files Browse the repository at this point in the history
- fixed corner radius 0 of folderDropdown flyout.
  • Loading branch information
rocksdanister committed Apr 23, 2024
1 parent c8e3a02 commit d75b911
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
Expand Up @@ -55,6 +55,7 @@
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="MinWidth" Value="200" />
<Setter Property="CornerRadius" Value="5" />
</Style>
</Flyout.FlyoutPresenterStyle>
<ListView
Expand Down
Expand Up @@ -217,7 +217,11 @@ private void CustomiseWallpaper(ScreenLayoutModel selection)
}

if (obj != null)
NavigatePage?.Invoke(this, new NavigatePageEventArgs() { Tag = "customiseWallpaper", Arg = obj });
{
var viewModel = App.Services.GetRequiredService<CustomiseWallpaperViewModel>();
viewModel.Load(obj);
NavigatePage?.Invoke(this, new NavigatePageEventArgs() { Tag = "customiseWallpaper", Arg = viewModel });
}
}
}

Expand Down
Expand Up @@ -16,13 +16,16 @@
x:Name="navView"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
ItemInvoked="navView_ItemInvoked"
ItemInvoked="NavView_ItemInvoked"
PaneDisplayMode="Top">
<NavigationView.MenuItems>
<NavigationViewItem Content="{x:Bind I18n.TitleWallpaper}" Tag="wallpaper" />
<NavigationViewItem Content="{x:Bind I18n.TitleScreenSaver}" Tag="screensaver" />
<!-- navView selection not visible to user -->
<NavigationViewItem Tag="customiseWallpaper" Visibility="Collapsed" />
<!-- navView selection not visible to user until navigated. -->
<NavigationViewItem
x:Name="customiseWallpaperItem"
Content="Customise"
Tag="customiseWallpaper" />
<NavigationViewItem Tag="customiseScreensaver" Visibility="Collapsed" />
</NavigationView.MenuItems>
<Frame x:Name="contentFrame" />
Expand Down
Expand Up @@ -29,12 +29,12 @@ namespace Lively.UI.WinUI.Views.Pages.ControlPanel
/// </summary>
public sealed partial class ControlPanelView : Page
{
private readonly List<(Type Page, string tag)> pages = new List<(Type Page, string tag)>
{
private readonly List<(Type Page, string tag)> pages =
[
(typeof(WallpaperLayoutView), "wallpaper"),
(typeof(ScreensaverLayoutView), "screensaver"),
(typeof(WallpaperLayoutCustomiseView), "customiseWallpaper"),
};
];

private class Localization
{
Expand All @@ -59,7 +59,7 @@ public ControlPanelView(ControlPanelViewModel vm)
private void Vm_NavigatePage(object sender, ControlPanelViewModel.NavigatePageEventArgs e) =>
NavigatePage(e.Tag, e.Arg);

private void navView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
if (args.InvokedItemContainer != null)
{
Expand All @@ -76,13 +76,16 @@ private void NavigatePage(string tag, object arg = null)
// Only navigate if the selected page isn't currently loaded.
if (!(nextNavPageType is null) && !Type.Equals(preNavPageType, nextNavPageType))
{
var effect = pages.FindIndex(p => p.Page.Equals(nextNavPageType)) < pages.FindIndex(p => p.Page.Equals(preNavPageType)) ?
// ->, <- direction based on order of item on the list.
var effect = pages.FindIndex(p => p.Page.Equals(nextNavPageType)) < pages.FindIndex(p => p.Page.Equals(preNavPageType)) ?
SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
contentFrame.Navigate(nextNavPageType, arg, new SlideNavigationTransitionInfo() { Effect = effect });

var item = navView.MenuItems.First(x => ((NavigationViewItem)x).Tag.ToString() == tag);
//Show selection only if visible.
navView.SelectedItem = ((UIElement)item).Visibility != Visibility.Collapsed ? item : navView.SelectedItem;
var currentNavViewItem = navView.MenuItems.First(x => ((NavigationViewItem)x).Tag.ToString() == tag) as NavigationViewItem;
// Show customise page only when in use.
customiseWallpaperItem.Visibility = currentNavViewItem.Tag.ToString() == customiseWallpaperItem.Tag.ToString() ? Visibility.Visible : Visibility.Collapsed;
//Show selection only if item is visible.
navView.SelectedItem = currentNavViewItem .Visibility != Visibility.Collapsed ? currentNavViewItem : navView.SelectedItem;
}
}
}
Expand Down
Expand Up @@ -8,25 +8,29 @@
Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" CornerRadius="5">
<Grid
Padding="25"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
CornerRadius="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Button
Grid.Column="0"
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Command="{Binding NavigateBackWallpaperCommand}">
Command="{Binding NavigateBackWallpaperCommand}"
Visibility="Collapsed">
<FontIcon FontSize="15" Glyph="&#xE72B;" />
</Button>
<Frame
x:Name="contentFrame"
Grid.ColumnSpan="2"
Width="325"
Grid.Column="1"
Margin="0,5,0,5"
HorizontalAlignment="Center" />
HorizontalAlignment="Stretch" />
</Grid>
</Page>

0 comments on commit d75b911

Please sign in to comment.