modify growlparent‘s initialization mode
This commit is contained in:
1 parent
aa8e443bd0
commit
53bfd7da17
3 files changed
+16
-11
No files matched your search
@@ -121,6 +121,19 @@ namespace HandyControl.Controls
|
||||
public static readonly DependencyProperty TypeProperty = DependencyProperty.Register(
|
||||
"Type", typeof(InfoType), typeof(Growl), new PropertyMetadata(default(InfoType)));
|
||||
|
||||
public static readonly DependencyProperty GrowlParentProperty = DependencyProperty.RegisterAttached(
|
||||
"GrowlParent", typeof(bool), typeof(Growl), new PropertyMetadata(default(bool), (o, args) =>
|
||||
{
|
||||
if (o is Panel panel)
|
||||
{
|
||||
SetGrowlPanel(panel);
|
||||
}
|
||||
}));
|
||||
|
||||
public static void SetGrowlParent(DependencyObject element, bool value) => element.SetValue(GrowlParentProperty, value);
|
||||
|
||||
public static bool GetGrowlParent(DependencyObject element) => (bool) element.GetValue(GrowlParentProperty);
|
||||
|
||||
public InfoType Type
|
||||
{
|
||||
get => (InfoType) GetValue(TypeProperty);
|
||||
@@ -196,7 +209,7 @@ namespace HandyControl.Controls
|
||||
/// 消息容器
|
||||
/// </summary>
|
||||
/// <param name="panel"></param>
|
||||
public static void SetGrowlPanel(Panel panel)
|
||||
private static void SetGrowlPanel(Panel panel)
|
||||
{
|
||||
GrowlPanel = panel;
|
||||
var menuItem = new MenuItem
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<userControl:MainContent Grid.Column="1"/>
|
||||
<GridSplitter Grid.Column="1" HorizontalAlignment="Left" Width="4" Background="Transparent" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource BorderBrush}"/>
|
||||
<controls:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True">
|
||||
<StackPanel IsHitTestVisible="True" VerticalAlignment="Top" Background="Transparent" Name="PanelMessage" Margin="0,10,10,10"/>
|
||||
<StackPanel controls:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
</controls:ScrollViewer>
|
||||
</Grid>
|
||||
</controls:WindowBorderless>
|
||||
@@ -1,18 +1,10 @@
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo
|
||||
namespace HandyControlDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Growl.SetGrowlPanel(PanelMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user