Quantcast
Viewing all articles
Browse latest Browse all 18858

Binding to IconSource - in the Notification Taskbar

Hello All,

I am using the custom taskbar, as per: http://www.codeproject.com/Articles/36468/WPF-NotifyIcon.

Here is my notification Icon's definition:

<tb:TaskbarIcon x:Name="myNotifyIcon" Visibility="Visible" 
                    ToolTipText="{  Binding Path=callModel.RecordingStatus, 
                                            Converter={StaticResource RecordingImageTooltipConverter}, 
                                            Mode=TwoWay, UpdateSourceTrigger=Explicit}" 
                    IconSource="{Binding Path=callModel.RecordingStatus, 
                         Converter={StaticResource CallImageConverter}, 
                         Mode=TwoWay, UpdateSourceTrigger=Explicit}" 
                    PopupActivation="DoubleClick" 
                    MenuActivation="LeftOrRightClick"><tb:TaskbarIcon.ContextMenu><ContextMenu><MenuItem Header="Open" Click="Open_Click"/><MenuItem Header="Close" Click="Close_Click"/></ContextMenu></tb:TaskbarIcon.ContextMenu></tb:TaskbarIcon>


As you can see above, I bind the Tooltip of this notification icon to a status enum on my model by using a Converter, that returns the right string to display; and it is working perfectly. 

However I try to do the same for the IconSource, but cannot get it to work. It fails with a URI Format Exception, stating: Invalid URI: The format of the URI could not be determined.

I think this somehow has to do with the following lines of code in my Converter class:

if (value == null || value.ToString().Equals("Idle")) { image = new BitmapImage(new Uri("../images/NotificationIcon/Idle.ico", UriKind.Relative)); }

...return image;

Maybe it should not be a URI, but some other object?

Hope you can help,

Harriet


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>