Merge branch 'master' into add-RelativePanel

This commit is contained in:
NaBian committed 2019-12-04 22:57:08 +08:00
commit af877ffc91
12 files changed
+68 -43

No files matched your search

@@ -434,6 +434,7 @@ namespace HandyControl.Controls
/// </summary>
private void Init()
{
if (_panelColor == null) return;
UpdateStatus(SelectedBrush.Color);
_panelColor.Children.Clear();
foreach (var item in _colorPresetList)
@@ -800,7 +800,7 @@ namespace HandyControl.Controls
_timerClose?.Stop();
var transform = new TranslateTransform();
_gridMain.RenderTransform = transform;
var animation = AnimationHelper.CreateAnimation(MaxWidth);
var animation = AnimationHelper.CreateAnimation(ActualWidth);
animation.Completed += (s, e) =>
{
if (Parent is Panel panel)
@@ -3,27 +3,30 @@ using System.Windows.Controls;
namespace HandyControl.Controls
{
[TemplatePart(Name = ElementGrowPanel, Type = typeof(Panel))]
internal class GrowlWindow : Window
public sealed class GrowlWindow : Window
{
private const string ElementGrowPanel = "PART_GrowPanel";
internal Panel GrowlPanel { get; set; }
public Panel GrowlPanel { get; set; }
public GrowlWindow()
internal GrowlWindow()
{
WindowStyle = WindowStyle.None;
AllowsTransparency = true;
GrowlPanel = new StackPanel
{
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 10, 10, 10)
};
Content = new ScrollViewer
{
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
IsEnableInertia = true,
Content = GrowlPanel
};
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
}
public void Init()
internal void Init()
{
var desktopWorkingArea = SystemParameters.WorkArea;
Height = desktopWorkingArea.Height;
@@ -78,5 +78,14 @@ namespace HandyControl.Controls
get => (Thickness)GetValue(BadgeMarginProperty);
set => SetValue(BadgeMarginProperty, value);
}
public static readonly DependencyProperty ShowBadgeProperty = DependencyProperty.Register(
"ShowBadge", typeof(bool), typeof(Badge), new PropertyMetadata(ValueBoxes.TrueBox));
public bool ShowBadge
{
get => (bool) GetValue(ShowBadgeProperty);
set => SetValue(ShowBadgeProperty, value);
}
}
}
@@ -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));
@@ -102,7 +102,15 @@ namespace HandyControl.Controls
/// </summary>
internal TabPanel TabPanel
{
get => _tabPanel ??= TabControlParent.HeaderPanel;
get
{
if (_tabPanel == null && TabControlParent != null)
{
_tabPanel = TabControlParent.HeaderPanel;
}
return _tabPanel;
}
set => _tabPanel = value;
}