It's trivial, but AvalonDock.ManagedContent supports an "Icon" (ImageSource). If ILayoutItem and the LayoutManager were to support this too, then you would have the ability to set an associated icon with your Document and/or Pad.

Due to AvalonDock's "DocumentPaneMenuItemStyle" style, one thing you'd get for free without any additional changes, is your icon displayed in the DocumentPane menu. Like so:

alt text

With a bit of restyling of the ManagedContent control, this would also open up the possibly of having your icon displayed next to your Title on the tab, or whatever you fancied (this is something I messed about with earlier - I might write up a 'question' on it at some point for anybody interested).

I'll provide an answer below with the changes necessary for anybody interested in hooking up this Icon in the meantime...

asked 23 Oct '10, 10:35

Lee's gravatar image

accept rate: 0%

edited 29 Nov '10, 23:10

Scott%20Whitlock's gravatar image

Scott Whitlock ♦♦

Changes required are as follows...


using System.Windows.Media;
ImageSource Icon { get; }


    public ImageSource Icon
            return _icon;
        protected set
            if (_icon != value)
                _icon = value;

    private ImageSource _icon;

    static readonly PropertyChangedEventArgs _iconArgs =
        NotifyPropertyChangedHelper.CreateArgs<AbstractLayoutItem>(o => o.Icon);

SoapBox.Core.Layout.LayoutManager - in the implementation of ShowDocument() and ShowPad(), where the content is created:

content.Icon = doc.Icon; // SowDocument()
content.Icon = pad.Icon; // ShowPad()

And to put it into use...

In the constructor of your Document or Pad:

this.Name   = "MyDocName";
this.Title  = "My Doc Title"
this.Icon   = _myDocIcon // (via a resource or whatever)

answered 23 Oct '10, 10:39

Lee's gravatar image

accept rate: 0%

edited 23 Oct '10, 10:50

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 23 Oct '10, 10:35

Seen: 1,688 times

Last updated: 29 Nov '10, 23:10

powered by OSQA