This commit is contained in:
NaBian 2019-12-04 00:43:17 +08:00
parent fc69669b06
commit 35abb9d02c

View File

@ -40,6 +40,8 @@ namespace HandyControl.Controls
{
if (item.Role == SideMenuItemRole.Item)
{
_isItemSelected = true;
if (Equals(item, _selectedItem)) return;
if (_selectedItem != null)
@ -53,7 +55,6 @@ namespace HandyControl.Controls
{
Info = e.OriginalSource
});
_isItemSelected = true;
}
else
{
@ -92,7 +93,10 @@ namespace HandyControl.Controls
}
else if(_selectedHeader != null)
{
_selectedHeader.SelectDefaultItem();
if (AutoSelect)
{
_selectedHeader.SelectDefaultItem();
}
_isItemSelected = false;
}
}
@ -117,6 +121,15 @@ namespace HandyControl.Controls
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
public static readonly DependencyProperty AutoSelectProperty = DependencyProperty.Register(
"AutoSelect", typeof(bool), typeof(SideMenu), new PropertyMetadata(ValueBoxes.TrueBox));
public bool AutoSelect
{
get => (bool) GetValue(AutoSelectProperty);
set => SetValue(AutoSelectProperty, value);
}
public static readonly DependencyProperty ExpandModeProperty = DependencyProperty.Register(
"ExpandMode", typeof(ExpandMode), typeof(SideMenu), new PropertyMetadata(default(ExpandMode), OnExpandModeChanged));