Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6211021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:15:51+00:00 2026-05-24T06:15:51+00:00

I am trying to modify the wpf tray icon at http://www.hardcodet.net/projects/wpf-notifyicon the aim is

  • 0

I am trying to modify the wpf tray icon at http://www.hardcodet.net/projects/wpf-notifyicon

the aim is to have a separate xaml file that would define a trayicon with a specific configuration, so that this configuration, in a separate file, could be easily added to say a wpf window.

im very new to wpf, but am trying to use ControlTemplate in a ResourceDictionary to achieve the aim:

Pointing to resource in App.xaml

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="trayicon.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

The separated configuration of trayicon.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification">
<ControlTemplate x:Key="TrayIcon" TargetType="{x:Type tb:TaskbarIcon}">
            <tb:TaskbarIcon x:Name="MyNotifyIcon"
        IconSource="/TaskbarNotification/DefaultTrayIcon.ico"
        ToolTipText="I am notified yes!"
        MenuActivation="LeftOrRightClick"></tb:TaskbarIcon>
</ControlTemplate>
</ResourceDictionary>

Trying to use the configuration

<Window x:Class="Test.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <tb:TaskbarIcon Template="{StaticResource TrayIcon}"></tb:TaskbarIcon>
</Grid>
</Window>

Exception thrown in MainWindow.xaml

The property ‘Template’ was not found in type ‘TaskbarIcon’

My guess is that i have to add some code to this custom wpf control that woudl expose the Template property and set it how it should be set?
But i have no idea how i would do that, could you point me in the right direction please?

Wild partial guess of code needed

public static readonly DependencyProperty TemplateProperty =
    DependencyProperty.Register("Template",
                                typeof (SomeTemplateType),
                                typeof (TaskbarIcon),
                                new FrameworkPropertyMetadata(SomeTemplateType.Empty, TemplatePropertyChanged));

[Category(CategoryName)]
[Description("Enables Templating.")]
public SomeTemplateType Template
{
  get { return (SomeTemplateType)TemplateProperty; }
  set { SetValue(TemplateProperty,value); }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:15:53+00:00Added an answer on May 24, 2026 at 6:15 am

    Cel I dont understand the template in the first place. The control template is targetted for tb:TaskbarIcon which actually has another tb:TaskbarIcon inside it!!!

    I assume you want following properties to be applied to TrayIcons across your application with their specified values…

         IconSource="/TaskbarNotification/DefaultTrayIcon.ico";
         ToolTipText="I am notified yes!";
         MenuActivation="LeftOrRightClick"
    

    If thats so then assuming that above properties are dependency properties, instead of creating a control template why dont you create a style which is targetted to tb:TaskbarIcon and specify Setters which set the above properties with their corresponding values.

       <Style x:Name="MyNotifyIcon" TargetType="{x:Type tb:TaskbarIcon}">
            <Setter Property="IconSource" Value="/TaskbarNotification/DefaultTrayIcon.ico"/>
            <Setter Property="ToolTipText" Value="I am notified yes!" />
            <Setter Property="MenuActivation" Value="LeftOrRightClick" />
      </Style>
    

    Then apply this style to your TaskbarIcon

      <tb:TaskbarIcon Style="{StaticResource MyNotifyIcon}"></tb:TaskbarIcon>
    

    So basically if this is what you are looking for, then template is out of question.
    Please suggest if this helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to modify App.cs and load the WPF XAML files from code
I am trying to modify the tutorial Ray Wenderlich has created at: http://www.raywenderlich.com/1888/how-to-create-a-simple-iphone-app-tutorial-part-33 So
I am trying to modify an existing WPF application for localization. One of my
I am trying to modify the controls of a Panel, have it update, then
I'm trying to modify the selection of a particular combobox. I have already retrieved
I'm trying to modify this code ( http://code.google.com/p/pypng/source/browse/trunk/code/texttopng ) so that it can render
I'm trying to modify the 'attr' function in the jQuery (V.6.1) core. I have
I want to create a timeline WPF control (as in this (http://www.taterboy.com/blog/images/MotionEditor/classic_vs_custom.png) kind of
I am trying to modify a stored procedure that I have to include a
I'm trying to modify a stored procedure used in an ASP.NET page. By default,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.