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

Lee
1413311
accept rate: 0%

edited 29 Nov '10, 23:10

Scott%20Whitlock's gravatar image

Scott Whitlock ♦♦
696262833


Changes required are as follows...

SoapBox.Core.ILayoutItem:

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

SoapBox.Core.AbstractLayoutItem:

    public ImageSource Icon
    {
        get
        {
            return _icon;
        }
        protected set
        {
            if (_icon != value)
            {
                _icon = value;
                NotifyPropertyChanged(_iconArgs);
            }
        }
    }

    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)
link

answered 23 Oct '10, 10:39

Lee's gravatar image

Lee
1413311
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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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

Tags:

×17
×11
×7
×5

Asked: 23 Oct '10, 10:35

Seen: 1,614 times

Last updated: 29 Nov '10, 23:10

powered by OSQA