This is a migrated thread and some comments may be shown as answers.

Pin main window to taskbar

7 Answers 677 Views
Window
This is a migrated thread and some comments may be shown as answers.
Richard Harrigan
Top achievements
Rank 1
Richard Harrigan asked on 07 Aug 2013, 09:52 PM
Hi,

I picked up the following code from the forum that enables my application to be placed in the task bar with the Icon that  i referenced.  This works well but if I pin the app to the taskbar the icon reverts back to the icon that normally shows in the microsoft main window.  How can I get my icon to persit when being pinned to the taskbar,  Also, while I am asking for help on the icon, how do I get the icon to also show in the window header.

Thanks
Rich


public void ShowInTaskbar(RadWindow control, string title)
        {
            control.Show();
            var window = control.ParentOfType<Window>();
            window.ShowInTaskbar = true;
            window.Title = title;
            var uri = new Uri("pack://application:,,,/Images/myapp.png");
            window.Icon = BitmapFrame.Create(uri);
        }

7 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 13 Aug 2013, 07:08 AM
Hello,

We are not aware of such issues when setting the icon of the RadWindow and minimizing it to the taskbar. It is possible that you haven't set application icon or you are running the application in debug mode. In that mode the application icon is not show.

I recorded a short video for you showing how to show the icon in the RadWindow title and in the taskbar, hope this is helpful. You can also find a sample project that demonstrates the approach seen in the video attached to my response.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 19 Sep 2013, 06:14 PM
Hi Vladi,

Could you modify this code to show the RadWindow created in the Xaml file.  Also I could't get the project into Visual Studio to test.  I am using Visual Studio 2012 Express.  I tried using your code as a guide except that my RadWindow (MainWindow) is created in xaml.  I got the same results as before.  While running the correct icon displays in the task bar but when I close the app it reverts back to the default icon.

Thanks
Rich
0
Vladi
Telerik team
answered on 20 Sep 2013, 12:20 PM
Hi,

I am not sure what you mean by created in the xaml RadWindow. If you mean that you have a UserControl that is of RadWindow type and you are settings its properties in the xaml, in order to set the icon you will need to set it like this:
<telerik:RadWindow ...>
    <telerik:RadWindow.Icon>
            <Image Source="my_app_window_icon.jpg"/>
    </telerik:RadWindow.Icon>
    ...
</telerik:RadWindow>

I attached a sample project and a short video for you showing that the icon is set correctly after pinning the RadWindow to the taskbar. Hope this is helpful.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 24 Sep 2013, 06:34 PM
Hi  Vladi,

Your example is not quite the same as what I am trying to do.

******** Your main window ***************

Window x:Class="WindowTaskbarIconTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Button Content="Open RadWindow" Click="Button_Click" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        <Button Content="Open MyRadWindow UserControl" Click="Button_Click_1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        <Image Source="C:\WPF Projects\WindowTaskbarIconTest\WindowTaskbarIconTest\Images\my_app_window_icon.jpg" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="24" Height="24"/>
    </StackPanel>
</Window>

========================================================================================================

*********** My main window ******************

<telerik:RadWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Cloudburst.QueryMaker.MainWindow"
        xmlns:local="clr-namespace:Cloudburst.QueryMaker"
        Header=" SQL Writer" Height="675" Width="1100" 
        WindowStartupLocation="CenterScreen" 
        Name="cloudburstWriter"
        WindowState="Normal"
        Loaded="Window_Loaded">
    <telerik:RadWindow.Icon>
        <Image Source="/Icons/16/results.png"/>
    </telerik:RadWindow.Icon>

============================================================================

I tried to assimilate your example by executing the following from the Window_Loaded event. 
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.ShowInTaskbar(this.cloudburstWriter, "Sql Writer");
}

 I can pin the the app to the taskbar but is shows a default icon,  not the icon displayed in the window header.  I used a release build and invoked from windows explorer.  Is it possible that it does not work when the main window is a telerik,RadWindow instead of a Window.  If possible can you change you example to where the main window is also a telerik.RadWindow.

Thanks
Rich
0
Vladi
Telerik team
answered on 25 Sep 2013, 11:31 AM
Hi,

The icon that is displayed in the taskbar of the MainWindow is the icon that is set in the Application Properties of the project rather then the one set to the icon of the RadWindow. When using RadWindow as MainWindow make sure that icon of the application is set in order to be able to see it in the taskbar.

I created and attached a sample project for you that shows that the icon is displayed correctly. Make sure that you run the project out of the debug mode (Ctrl+F5) because in it the application icon is not displayed.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 25 Sep 2013, 04:54 PM
Hi Vladi

I could not get your sample into windows 8, visual studio 2012 express.  Could you provide your sample with a visual studio solution file.  I modified my xaml file as shown in your example ( see below).  The icon did not show up in the taskbar.  I'm  still getting the default icon.  In your example the file 'my_app.ico' did not seem to be referenced anywhere.  Is that the icon that is supposed to show up in the taskbar?

Thanks
Rich

<telerik:RadWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Cloudburst.QueryMaker.MainWindow"
        xmlns:local="clr-namespace:Cloudburst.QueryMaker"
        Header=" SQL Writer" Height="675" Width="1100" 
        WindowStartupLocation="CenterScreen" 
        Name="cloudburstWriter"
        WindowState="Normal"
        xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
telerikNavigation:RadWindowInteropHelper.ShowInTaskbar="True"

        Loaded="Window_Loaded">
    <telerik:RadWindow.Icon>
        <Image Source="/Icons/32/apply.ico"/>
    </telerik:RadWindow.Icon>
0
Richard Harrigan
Top achievements
Rank 1
answered on 25 Sep 2013, 10:13 PM
Hi Vladi,

I reread your last post and changed the icon in the application icon property page, all is well, I hadn't changed this property before and therefore did not interpret you post correctly.

Thanks for staying with me.
Rich
Tags
Window
Asked by
Richard Harrigan
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Richard Harrigan
Top achievements
Rank 1
Share this question
or