Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TaskbarIcon.Declarations.cs #60

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ The sample below shows some of the properties of the control. For a more compreh
</Window>
```

## Contributors and Thanks

Hi, I'm Philipp! This little library was originally written by me, but is currently mostly maintained by [Jan Karger](https://github.com/punker76) and [Robin Krom](https://github.com/Lakritzator). Big, big kudos to the two of you, and everybody else who [contributed](https://github.com/hardcodet/wpf-notifyicon/graphs/contributors) to this library. You rock!

Make sure to check out Robin's great [Greenshot](https://getgreenshot.org/) tool (that I use on a daily basis), and Jan's [MahApps](https://github.com/MahApps) UI framework.

42 changes: 41 additions & 1 deletion src/NotifyIconWpf/TaskbarIcon.Declarations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,46 @@ private void OnIconSourcePropertyChanged(DependencyPropertyChangedEventArgs e)
if (!Util.IsDesignMode) Icon = newValue.ToIcon();
}

#endregion

#region IconInMemory

/// <summary>
/// Updates the <see cref="Icon" /> property.
/// </summary>
public static readonly DependencyProperty IconInMemoryProperty =
DependencyProperty.Register(nameof(IconInMemory),
typeof(Icon),
typeof(TaskbarIcon),
new FrameworkPropertyMetadata(null, IconInMemoryPropertyChanged));

/// <summary>
/// A property wrapper for the <see cref="IconInMemory"/>
/// dependency property:<br/>
/// Updates the <see cref="Icon" /> property.
/// </summary>
[Category(CategoryName)]
[Description("Sets the displayed taskbar icon.")]
public Icon IconInMemory
{
get { return (Icon)GetValue(IconInMemoryProperty); }
set { SetValue(IconInMemoryProperty, value); }
}

private static void IconInMemoryPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
TaskbarIcon owner = (TaskbarIcon)d;
owner.OnIconInMemoryPropertyChanged(e);
}

private void OnIconInMemoryPropertyChanged(DependencyPropertyChangedEventArgs e)
{
Icon newValue = (Icon)e.NewValue;

//resolving the ImageSource at design time is unlikely to work
if (!Util.IsDesignMode) Icon = newValue;
}

#endregion

#region ToolTipText dependency property
Expand Down Expand Up @@ -1893,4 +1933,4 @@ static TaskbarIcon()
ContextMenuProperty.OverrideMetadata(typeof (TaskbarIcon), md);
}
}
}
}