Dave

May 12, 2010 at 10:39 PM

Hi

I am trying to set the Icon for both DocumentContent and DockableContent via code at runtime. Although the Icon property of these appear to be set, no icon is displayed. The main wpf window icon can be set fine, so it is not the way I appear the be setting it.

Both types of window are created as seperate xaml files which are loded at runtime into the main dockpanel. It seems that all expected aspects work as expected with the exception of the Icon.

After instantiating either window type I have set the Icon from a resource png file or tried using a relative uri path. Again the icon appears to be set but does not show.

I note tha in te demo, if the  DocumentContent and DockableContent are preset within the xaml at designtime then the icon can be set. But here again this seems to only work if the host is inside the DockPanel. Setting the Icon in the xaml of a seperate window file compiles but does not display as above.

I would be grateful if you could advise me as to what direction I should take!

Thanks

 

 

May 20, 2010 at 4:46 PM

Could you please post some code?

Thanks

Ado

May 22, 2010 at 10:33 AM

Hi Ado

There is no code as such.

I have tried :

Doc.Icon=Icon

Doc.Icon=Image

Doc.Icon=ImageSource

Doc.Icon=BitmapSource

None error but none display an icon. The Doc above is for both DocumentContent and DockableContent.

Even in xaml I find the same thing with one exception. In the demo example you supply I see some docable tabs with icons. Trying to replicate this results in the following:

DocumentContent will not display an icon at all. DockableContent will only display an icon provided the dockable is hosted by a dockpane. This means that an independent window written to be added at runtime will not display a icon at all. With standard xaml tabs I can add an icon(in xaml or c# a runtime) within a stack for the tabheader as it accepts an object, however looking at the code for the title in avalondock it only accepts a string.

I did a search on the web and found a comment from someone that they had to "tweek" the code to display icons, but they did not indicate what thy did.

I am in te process of upgrading an app from winforms using weifenlou docking which displays the icons I therefore need to replicate at least the original functionality.

just in case you might wonder, I can display icons using the same icon generation for display in menuitems - so this indicates that a valid icon object is being created.

thanks 

May 22, 2010 at 6:54 PM

Hi Dave

I got icons working in both tabs and external windows (though the tab height had to increase a little to accomodate them).

If you or anyone is interested and can tell me how to post a zip file here, I'll happily upload so you can diff against the original to see what changes I made.
(There may one or two other features you don't want. For example, I added a PermanentDocumentPane because I wanted it to hang around even if the last tab got dragged off)

Cheers
Simon

 

May 23, 2010 at 2:17 PM

Hi Simon

Great you have a solution.

I have no idea how to upload zip files to hre but I think that as this is a bug, the base code will need to have your fix too so it would be a good idea to make the code available for the avalondock dev team anyway.

Is there any way you could insert/list the appropriate class or code changes you made in the meantime using the code insert button? alternatively if it is acceptable you could email it me direct, though it seems generally not acceptable to post email addresses on forums!

May 24, 2010 at 6:33 AM

Hi Dave

Sent private re zip file.

As I recall, there was no support for icons in the tabs, only the drop down window list. So it was more by design than a bug.

Cheers
Simon

May 31, 2010 at 4:05 PM
Edited May 31, 2010 at 4:06 PM

Hi Simon

In order to upload your code, you can create an Issue Tracker. So, you can explain your case, solution and you can attach your project :d

Thanks anyway, your code will be very helpful to us.

 

Cheers

GUSTAVO