1

My solution's structure is:

enter image description here

CI.Frontier.Classic contains a MEF module. My application uses the RibbonWindow control, and the modules define what menu items should be created. I can successfully add a button to the ribbon control from the CI.Frontier.Classic module, however, I cannot figure out the proper Uri to ClassicFrontierToopTip.png

Heres the code in FrontierClassic.cs that creates the tab, button and attempting to set the ribbon ToolTipImage

public void CreateMenuItems()
{
    TabData tabData = new TabData("Legacy");

    GroupData groupData = new GroupData("Internal");
    tabData.GroupDataCollection.Add(groupData);

    ButtonData classicFrontierBtn = new ButtonData()
    {
        Label = "Classic Frontier",
        ToolTipTitle = "Classic Frontier",
        ToolTipDescription = "Open Classic Frontier",
        ToolTipImage = new Uri("./Graphics/ClassicFrontierToolTip.png", UriKind.Relative)
    };
    classicFrontierBtn.Command.RegisterCommand(new DelegateCommand(LoadFrontierView));


    groupData.ControlDataCollection.Add(classicFrontierBtn);

    _ribbonService.AddTab(tabData);
}

This Uri doesn't work as the tooltip does not display. Can I use the UriKind.Relative or should I be using some sort of "pack uri"?

Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149

2 Answers2

3

The robust approach would be to leverage the pack syntax...

new Uri("pack://application:,,,/CI.Frontier.Classic;component/Graphics/ClassicFrontierToolTip.png", UriKind.Absolute);
Aaron McIver
  • 24,527
  • 5
  • 59
  • 88
0

Include an icon for a Prism module solved it...

ToolTipImage = new Uri("/" + GetType().Assembly.ToString().Split(',')[0] + ";component/Graphics/ClassicFrontierToolTip.png", UriKind.Relative)

Not sure if this is the best solution though.

Community
  • 1
  • 1
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149