Skip to content

Commit

Permalink
NavigationView-pre has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
PieroCastillo committed Oct 7, 2020
1 parent 5d1e7ef commit d4949b6
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 136 deletions.
31 changes: 0 additions & 31 deletions src/Aura.UI/Controls/ColourSlider.cs

This file was deleted.

66 changes: 0 additions & 66 deletions src/Aura.UI/Controls/Follower.cs

This file was deleted.

68 changes: 55 additions & 13 deletions src/Aura.UI/Controls/Navigation/NavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,39 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
ToggleNav.PointerPressed += ToggleNav_PointerPressed;
}

protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
{
base.OnPropertyChanged(change);

//if(change.Property == SelectedItemProperty)
//{
ChangeSelectedTitle();
//}
}

private void ChangeSelectedTitle()
{
if(SelectedItem is NavigationViewItem)
{
Title = (SelectedItem as NavigationViewItem).Title;
}
}

private void ToggleNav_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
{
ToggleNavigationViewExpansionState(this);
ToggleNavigationViewOpenState(this);
}

public static void ToggleNavigationViewExpansionState(NavigationView navigationView)
public static void ToggleNavigationViewOpenState(NavigationView navigationView)
{
var e = navigationView.ExpansionState;
var e = navigationView.IsOpen;
switch (e)
{
case ExpansionState.Total:
navigationView.ExpansionState = ExpansionState.Hidden;
case true:
navigationView.IsOpen = false;
break;
case ExpansionState.Hidden:
navigationView.ExpansionState = ExpansionState.Total;
case false:
navigationView.IsOpen = true;
break;
}
}
Expand All @@ -52,13 +69,22 @@ public static void ToggleNavigationViewExpansionState(NavigationView navigationV
/// <summary>
/// Get or set the expansion state of the NavigationView
/// </summary>
public ExpansionState ExpansionState
public bool IsOpen
{
get { return GetValue(IsOpenProperty); }
set { SetValue(IsOpenProperty, value); }
}
public static readonly StyledProperty<bool> IsOpenProperty =
AvaloniaProperty.Register<NavigationView, bool>(nameof(IsOpen), false);

public object Title
{
get { return GetValue(ExpansionStateProperty); }
set { SetValue(ExpansionStateProperty, value); }
get => GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
public static readonly StyledProperty<ExpansionState> ExpansionStateProperty =
AvaloniaProperty.Register<NavigationView, ExpansionState>(nameof(ExpansionState), ExpansionState.Total);
public static readonly StyledProperty<object> TitleProperty =
AvaloniaProperty.Register<NavigationView, object>(nameof(Title), "Title");


public object Header
{
Expand All @@ -75,6 +101,22 @@ public ITemplate HeaderTemplate
}
public static readonly StyledProperty<ITemplate> HeaderTemplateProperty =
AvaloniaProperty.Register<NavigationView, ITemplate>(nameof(HeaderTemplate));

public double CompactPaneLength
{
get => GetValue(CompactPaneLengthProperty);
set => SetValue(CompactPaneLengthProperty, value);
}
public static readonly StyledProperty<double> CompactPaneLengthProperty =
AvaloniaProperty.Register<NavigationView, double>(nameof(CompactPaneLength), 150);

public double OpenPaneLength
{
get => GetValue(OpenPaneLengthProperty);
set => SetValue(OpenPaneLengthProperty, value);
}
public static readonly StyledProperty<double> OpenPaneLengthProperty =
AvaloniaProperty.Register<NavigationView, double>(nameof(OpenPaneLength), 50);
#endregion
}
}
}
42 changes: 36 additions & 6 deletions src/Aura.UI/Controls/Navigation/NavigationViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,33 @@

namespace Aura.UI.Controls.Navigation
{
public class NavigationViewItem : TabItem
public class NavigationViewItem : TabItem, IHeadered
{
/// <summary>
/// Get or set the expansion state of the NavigationViewItem
/// </summary>
public ExpansionState ExpansionState
public bool IsOpen
{
get { return GetValue(ExpansionStateProperty); }
set { SetValue(ExpansionStateProperty, value); }
get { return GetValue(IsOpenProperty); }
set { SetValue(IsOpenProperty, value); }
}
public static readonly StyledProperty<ExpansionState> ExpansionStateProperty =
AvaloniaProperty.Register<NavigationViewItem, ExpansionState>(nameof(ExpansionState), ExpansionState.Total);
public static readonly StyledProperty<bool> IsOpenProperty =
AvaloniaProperty.Register<NavigationViewItem, bool>(nameof(IsOpen), false);

public double CompactLength
{
get { return GetValue(CompactLengthProperty); }
set { SetValue(CompactLengthProperty, value); }
}
public static readonly StyledProperty<double> CompactLengthProperty =
AvaloniaProperty.Register<NavigationViewItem, double>(nameof(CompactLength), 50);
public double OpenLength
{
get { return GetValue(OpenLengthProperty); }
set { SetValue(OpenLengthProperty, value); }
}
public static readonly StyledProperty<double> OpenLengthProperty =
AvaloniaProperty.Register<NavigationViewItem, double>(nameof(OpenLength), 150);

public IImage Icon
{
Expand All @@ -28,5 +43,20 @@ public IImage Icon
public static readonly StyledProperty<IImage> IconProperty =
AvaloniaProperty.Register<NavigationViewItem, IImage>(nameof(Icon));

public bool IsHeader
{
get => GetValue(IsHeaderProperty);
set => SetValue(IsHeaderProperty, value);
}
public static readonly StyledProperty<bool> IsHeaderProperty =
AvaloniaProperty.Register<NavigationViewItem, bool>(nameof(IsHeader), false);

public object Title
{
get => GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
public static readonly StyledProperty<object> TitleProperty =
AvaloniaProperty.Register<NavigationViewItem, object>(nameof(Title), "Title");
}
}
10 changes: 10 additions & 0 deletions src/Aura.UI/Controls/Ribbon/Ribbon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ public ExpansionState ExpansionState
public static readonly StyledProperty<ExpansionState> ExpansionStateProperty =
AvaloniaProperty.Register<Ribbon, ExpansionState>(nameof(ExpansionState), ExpansionState.Total);

/// <summary>
/// Defines the Pane Height of the Ribbon when this is opened
/// </summary>
public double OpenPaneHeight
{
get => GetValue(OpenPaneLengthProperty);
set => SetValue(OpenPaneLengthProperty, value);
}
public static readonly StyledProperty<double> OpenPaneLengthProperty =
AvaloniaProperty.Register<Ribbon, double>(nameof(OpenPaneHeight), 150);
//public Ribbon Self
//{
// get { return this; }
Expand Down
20 changes: 0 additions & 20 deletions src/Aura.UI/Controls/Thumbs/ColourThumb.cs

This file was deleted.

0 comments on commit d4949b6

Please sign in to comment.