mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-25 09:45:36 -05:00
WPF NotifyIcon 1.0.2
-------------------- FIX DataContext was not properly updated on ContextMenus (and probably ToolTips, Popups, and Balloons) if the DC was previously null. git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@110 9f600761-6f11-4665-b6dc-0185e9171623
This commit is contained in:
@@ -568,7 +568,13 @@ namespace Hardcodet.Wpf.TaskbarNotification
|
||||
/// </summary>
|
||||
private void UpdateDataContext(FrameworkElement target, object oldDataContextValue, object newDataContextValue)
|
||||
{
|
||||
if (target != null && !target.IsDataContextDataBound() && Equals(oldDataContextValue, target.DataContext))
|
||||
//if there is no target or it's data context is determined through a binding
|
||||
//of its own, keep it
|
||||
if (target == null || target.IsDataContextDataBound()) return;
|
||||
|
||||
//if the target's data context is the NotifyIcon's old DataContext or the NotifyIcon itself,
|
||||
//update it
|
||||
if (ReferenceEquals(this, target.DataContext) || Equals(oldDataContextValue, target.DataContext))
|
||||
{
|
||||
//assign own data context, if available. If there is no data
|
||||
//context at all, assign NotifyIcon itself.
|
||||
|
||||
Reference in New Issue
Block a user