feat: move to menu.
This commit is contained in:
@@ -24,57 +24,59 @@
|
||||
<DoubleTransition Property="Width" Duration="0:0:0.1" />
|
||||
</Transitions>
|
||||
</Border.Transitions>
|
||||
<Grid
|
||||
Name="PART_RootGrid"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
RowDefinitions="Auto, *, Auto, Auto">
|
||||
<StackPanel
|
||||
Margin="{DynamicResource NavigationMenuHeaderMargin}"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ContentPresenter
|
||||
Name="PART_IconPresenter"
|
||||
Margin="{DynamicResource NavigationMenuIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}" />
|
||||
<ContentPresenter
|
||||
Name="PART_HeaderPresenter"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}" />
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<Grid
|
||||
Name="PART_RootGrid"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
RowDefinitions="Auto, *, Auto, Auto">
|
||||
<StackPanel
|
||||
Margin="{DynamicResource NavigationMenuHeaderMargin}"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ContentPresenter
|
||||
Name="PART_IconPresenter"
|
||||
Margin="{DynamicResource NavigationMenuIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}" />
|
||||
<ContentPresenter
|
||||
Name="PART_HeaderPresenter"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}" />
|
||||
|
||||
</StackPanel>
|
||||
<ItemsPresenter Grid.Row="1" ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<ContentPresenter
|
||||
Name="PART_FooterPresenter"
|
||||
Grid.Row="2"
|
||||
Content="{TemplateBinding Footer}"
|
||||
ContentTemplate="{TemplateBinding FooterTemplate}" />
|
||||
<ToggleSwitch
|
||||
Name="{x:Static u:NavigationMenu.PART_CloseButton}"
|
||||
Grid.Row="3"
|
||||
Content="Open"
|
||||
IsChecked="{TemplateBinding IsClosed,
|
||||
Mode=TwoWay}"
|
||||
IsVisible="{TemplateBinding ShowCollapseButton}"
|
||||
Theme="{DynamicResource ButtonToggleSwitch}">
|
||||
<ToggleSwitch.OnContent>
|
||||
<PathIcon
|
||||
Width="{DynamicResource NavigationMenuExpandIconWidth}"
|
||||
Height="{DynamicResource NavigationMenuExpandIconHeight}"
|
||||
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</ToggleSwitch.OnContent>
|
||||
<ToggleSwitch.OffContent>
|
||||
<PathIcon
|
||||
Width="{DynamicResource NavigationMenuExpandIconWidth}"
|
||||
Height="{DynamicResource NavigationMenuExpandIconHeight}"
|
||||
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</ToggleSwitch.OffContent>
|
||||
</ToggleSwitch>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ItemsPresenter Grid.Row="1" ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
<ContentPresenter
|
||||
Name="PART_FooterPresenter"
|
||||
Grid.Row="2"
|
||||
Content="{TemplateBinding Footer}"
|
||||
ContentTemplate="{TemplateBinding FooterTemplate}" />
|
||||
<ToggleSwitch
|
||||
Name="{x:Static u:NavigationMenu.PART_CloseButton}"
|
||||
Grid.Row="3"
|
||||
Content="Open"
|
||||
IsChecked="{TemplateBinding IsClosed,
|
||||
Mode=TwoWay}"
|
||||
IsVisible="{TemplateBinding ShowCollapseButton}"
|
||||
Theme="{DynamicResource ButtonToggleSwitch}">
|
||||
<ToggleSwitch.OnContent>
|
||||
<PathIcon
|
||||
Width="{DynamicResource NavigationMenuExpandIconWidth}"
|
||||
Height="{DynamicResource NavigationMenuExpandIconHeight}"
|
||||
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</ToggleSwitch.OnContent>
|
||||
<ToggleSwitch.OffContent>
|
||||
<PathIcon
|
||||
Width="{DynamicResource NavigationMenuExpandIconWidth}"
|
||||
Height="{DynamicResource NavigationMenuExpandIconHeight}"
|
||||
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</ToggleSwitch.OffContent>
|
||||
</ToggleSwitch>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
@@ -131,7 +131,7 @@ public class NavigationMenuItem: HeaderedSelectingItemsControl
|
||||
|
||||
if (_rootMenu is not null)
|
||||
{
|
||||
IsClosed = _rootMenu.IsClosed;
|
||||
// IsClosed = _rootMenu.IsClosed;
|
||||
}
|
||||
|
||||
_rootMenu?.GetObservable(NavigationMenu.IsClosedProperty)
|
||||
@@ -139,7 +139,7 @@ public class NavigationMenuItem: HeaderedSelectingItemsControl
|
||||
_rootMenu?.UpdateSelectionFromSelectedItem(_rootMenu.SelectedItem);
|
||||
_popup = e.NameScope.Find<Popup>(PART_Popup);
|
||||
Level = CalculateDistanceFromLogicalParent<NavigationMenu>(this) - 1;
|
||||
bool isTopLevel = Level == 1;
|
||||
bool isTopLevel = Level == 0;
|
||||
IsTopLevelMenuItem = isTopLevel;
|
||||
PseudoClasses.Set(PC_TopLevel, isTopLevel);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class NavigationMenuItem: HeaderedSelectingItemsControl
|
||||
{
|
||||
if (_rootMenu is not null )
|
||||
{
|
||||
object? o = this.DataContext ?? this;
|
||||
object? o = this.DataContext == _rootMenu.DataContext ? this : this.DataContext ?? this;
|
||||
_rootMenu.SelectedItem = o;
|
||||
}
|
||||
SetSelection(this, true, true);
|
||||
@@ -219,7 +219,7 @@ public class NavigationMenuItem: HeaderedSelectingItemsControl
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selected)
|
||||
if (selected && source!=null)
|
||||
{
|
||||
_rootMenu?.UpdateSelection(this);
|
||||
}
|
||||
@@ -262,7 +262,10 @@ public class NavigationMenuItem: HeaderedSelectingItemsControl
|
||||
|
||||
while (logical != null && !(logical is T))
|
||||
{
|
||||
++result;
|
||||
if (logical is NavigationMenuItem)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
logical = logical.LogicalParent;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public class TagInput : TemplatedControl
|
||||
private void OnInputThemePropertyChanged(AvaloniaPropertyChangedEventArgs args)
|
||||
{
|
||||
var newTheme = args.GetNewValue<ControlTheme>();
|
||||
if (newTheme.TargetType == typeof(TextBox))
|
||||
if (newTheme?.TargetType == typeof(TextBox))
|
||||
{
|
||||
_textBox.Theme = newTheme;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user