OutlookBarItem Icon in ResourceDictionary

4 posts, 0 answers
  1. Renier Pretorius
    Renier Pretorius avatar
    46 posts
    Member since:
    Apr 2010

    Posted 28 Oct 2013 Link to this post

    I am building a solution with multiple front-end clients and wish to maintain a consistent Look&Feel between them. For this I have created a shared Silverlight library which contains common resources including all images/icons. I have declared a resource dictionary in this project which I then merge into the other client projects in the root visual. I have used this successfully to add image to a RadButton as follows:
    <ResourceDictionary
         
        <ImageSource x:Key="HomeIcon">Images/house_16xLG.png</ImageSource>
         
    </ResourceDictionary>

    <telerik:RadButton.Content>
        <StackPanel Orientation="Horizontal">
            <Image Source="{StaticResource HomeIcon}" Margin="3" Stretch="None" VerticalAlignment="Center" />
            <TextBlock Text="Home" VerticalAlignment="Center" Margin="3"/>
        </StackPanel>
    </telerik:RadButton.Content>

    Now I also want to use these images as icons for RadOutlookBarItem but I am struggling to find the right syntax (assuming that it is possible)
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 30 Oct 2013 Link to this post

    Hi Renier,

    I am not sure that I understand where you need to add that image. Could you please take a look at the visual structure of the RadOutlookBar control and let us know the exact place where you need to import your image.

    Thank you for your cooperation.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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 >>
  3. DevCraft banner
  4. Renier Pretorius
    Renier Pretorius avatar
    46 posts
    Member since:
    Apr 2010

    Posted 30 Oct 2013 Link to this post

    Hi Pavel,

    Sorry if my post was not clear. I have found a workaround but it is not quite as elegant as the image dictionary method I wanted to use.

    What I am using is:
    <telerik:RadOutlookBarItem Header="General"
        Icon="/KIO.Logistics.Apps.Common;component/Resources/Images/screwdriver_24xLG.png"
        SmallIcon="/KIO.Logistics.Apps.Common;component/Resources/Images/screwdriver_16xLG.png">
    </telerik:RadOutlookBarItem>

    What I wanted to do was:
    <telerik:RadOutlookBarItem Header="General"
        Icon="{StaticResource ScrewDriverIconLarge}"
        SmallIcon="{StaticResource ScrewDriverIconSmall}">
    </telerik:RadOutlookBarItem>

    My issue is what to put here:
    <ResourceDictionary
     
        <ImageSource x:Key="HomeIcon">Images/house_16xLG.png</ImageSource>
     
         <telerik:RadOutlookBarItem.Icon x:Key="ScrewDriverIconLarge">Images/screwdriver_16xLG.png</telerik:RadOutlookBarItem.Icon> <== THIS LINE
     
    </ResourceDictionary>

    Thanks for your assistance

    Regards

    Renier
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 04 Nov 2013 Link to this post

    Hi Renier,

    The approach that you came up with is a possible solution in your case.

    However, you can try merging your custom dictionary as application resource. You can find more information on that matter here. When following this approach you need to have in mind that the Silverlight plug-in has limited access to the file system. You can find more information here.

    Once the dictionary is merged you should be able to access the images by x:Key attribute.

    I hope this information is helpful.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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 >>
Back to Top