Skip to content

Commit 67845f3

Browse files
committed
fix: closed #1706
1 parent 0f65abb commit 67845f3

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

src/Net_40/HandyControl_Net_40/Themes/Theme.xaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13625,6 +13625,7 @@
1362513625
<Style x:Key="TabControlCapsule" TargetType="TabControl">
1362613626
<Setter Property="BorderThickness" Value="1" />
1362713627
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
13628+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
1362813629
<Setter Property="hc:TitleElement.BorderBrush" Value="{DynamicResource PrimaryBrush}" />
1362913630
<Setter Property="hc:TitleElement.Background" Value="{DynamicResource RegionBrush}" />
1363013631
<Setter Property="hc:TitleElement.Foreground" Value="{DynamicResource PrimaryBrush}" />
@@ -13646,7 +13647,7 @@
1364613647
<RowDefinition x:Name="RowDefinition1" Height="*" />
1364713648
</Grid.RowDefinitions>
1364813649
<UniformGrid Rows="1" KeyboardNavigation.TabNavigation="Once" KeyboardNavigation.DirectionalNavigation="Cycle" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="0" Grid.Row="0" />
13649-
<Border x:Name="contentPanel" Margin="0,6,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" Grid.Row="1">
13650+
<Border x:Name="contentPanel" Margin="0,6,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" Grid.Row="1">
1365013651
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
1365113652
</Border>
1365213653
</Grid>

src/Shared/HandyControlDemo_Shared/UserControl/Controls/NotifyIconDemo.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<hc:SimplePanel Margin="32" VerticalAlignment="Center">
1212
<StackPanel>
1313
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
14-
<GroupBox Header="ContextMenu" Padding="10">
14+
<GroupBox Header="ContextMenu" Padding="10" Background="{DynamicResource RegionBrush}">
1515
<StackPanel>
1616
<GroupBox hc:TitleElement.TitlePlacement="Left" Style="{StaticResource GroupBoxOriginal}" Header="{ex:Lang Key={x:Static langs:LangKeys.Visibility}}">
1717
<ToggleButton IsChecked="{Binding ContextMenuIsShow}" Style="{StaticResource ToggleButtonSwitch}"/>
@@ -22,7 +22,7 @@
2222
</GroupBox>
2323
</StackPanel>
2424
</GroupBox>
25-
<GroupBox Header="ContextContent" Margin="16,0,0,0" Padding="10">
25+
<GroupBox Header="ContextContent" Margin="16,0,0,0" Padding="10" Background="{DynamicResource RegionBrush}">
2626
<StackPanel>
2727
<GroupBox hc:TitleElement.TitlePlacement="Left" Style="{StaticResource GroupBoxOriginal}" Header="{ex:Lang Key={x:Static langs:LangKeys.Visibility}}">
2828
<ToggleButton IsChecked="{Binding ContextContentIsShow}" Style="{StaticResource ToggleButtonSwitch}"/>

src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs

+15-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class NotifyIcon : FrameworkElement, IDisposable
6262

6363
static NotifyIcon()
6464
{
65-
VisibilityProperty.OverrideMetadata(typeof(NotifyIcon), new PropertyMetadata(Visibility.Visible, OnVisibilityChanged));
65+
VisibilityProperty.OverrideMetadata(typeof(NotifyIcon), new PropertyMetadata(ValueBoxes.VisibleBox, OnVisibilityChanged));
6666
DataContextProperty.OverrideMetadata(typeof(NotifyIcon), new FrameworkPropertyMetadata(DataContextPropertyChanged));
6767
ContextMenuProperty.OverrideMetadata(typeof(NotifyIcon), new FrameworkPropertyMetadata(ContextMenuPropertyChanged));
6868
}
@@ -247,7 +247,19 @@ public string Token
247247
}
248248

249249
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
250-
nameof(Text), typeof(string), typeof(NotifyIcon), new PropertyMetadata(default(string)));
250+
nameof(Text), typeof(string), typeof(NotifyIcon), new PropertyMetadata(default(string), OnTextChanged));
251+
252+
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
253+
{
254+
var ctl = (NotifyIcon) d;
255+
256+
if (ctl._windowClassName == null)
257+
{
258+
return;
259+
}
260+
261+
ctl.UpdateIcon(ctl._added, ctl._isTransparent);
262+
}
251263

252264
public string Text
253265
{
@@ -309,7 +321,6 @@ public TimeSpan BlinkInterval
309321
private static void OnIsBlinkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
310322
{
311323
var ctl = (NotifyIcon) d;
312-
if (ctl.Visibility != Visibility.Visible) return;
313324
if ((bool) e.NewValue)
314325
{
315326
if (ctl._dispatcherTimerBlink == null)
@@ -326,7 +337,7 @@ private static void OnIsBlinkChanged(DependencyObject d, DependencyPropertyChang
326337
{
327338
ctl._dispatcherTimerBlink?.Stop();
328339
ctl._dispatcherTimerBlink = null;
329-
ctl.UpdateIcon(true);
340+
ctl.UpdateIcon(ctl._added, ctl._isTransparent);
330341
}
331342
}
332343

src/Shared/HandyControl_Shared/Themes/Theme.xaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13777,6 +13777,7 @@
1377713777
<Style x:Key="TabControlCapsule" TargetType="TabControl">
1377813778
<Setter Property="BorderThickness" Value="1" />
1377913779
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
13780+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
1378013781
<Setter Property="hc:TitleElement.BorderBrush" Value="{DynamicResource PrimaryBrush}" />
1378113782
<Setter Property="hc:TitleElement.Background" Value="{DynamicResource RegionBrush}" />
1378213783
<Setter Property="hc:TitleElement.Foreground" Value="{DynamicResource PrimaryBrush}" />
@@ -13798,7 +13799,7 @@
1379813799
<RowDefinition x:Name="RowDefinition1" Height="*" />
1379913800
</Grid.RowDefinitions>
1380013801
<UniformGrid Rows="1" KeyboardNavigation.TabNavigation="Once" KeyboardNavigation.DirectionalNavigation="Cycle" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="0" Grid.Row="0" />
13801-
<Border x:Name="contentPanel" Margin="0,6,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" Grid.Row="1">
13802+
<Border x:Name="contentPanel" Margin="0,6,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" Grid.Row="1">
1380213803
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
1380313804
</Border>
1380413805
</Grid>

0 commit comments

Comments
 (0)