How can I use an image on Application bar

Jul 12, 2013 at 5:02 AM
Hi all,
May I ask a question? I want to use an image on Application bar, but it always has a circle around, how can I remove that circle?

Thanks for your answer.
Coordinator
Jul 13, 2013 at 12:47 PM
No. ApplicationBar used CommandBar as container for other elements. This issue will be fixed in next verison.
Sorry...
Jul 15, 2013 at 4:55 AM
Thank you so much, hoping your next.
Nov 12, 2013 at 11:44 PM
Any chance there has been progress on this?
I am trying to add a few basic controls (checkbox etc) into the ApplicationBar and also need to somehow disable the circle.

Thanks,
Marek
Coordinator
Nov 13, 2013 at 2:37 PM
Only in next version. I'm sorry.
But you can use temporary solution. Try to inherit your own AppBar from Application class and override two methods:
protected override bool IsItemItsOwnContainerOverride(object item)
        {
            return (item is AppBarItem);
        }

        protected override DependencyObject GetContainerForItemOverride()
        {
            return new AppBarItem();
        }
Where AppBarItem is your own class inherited from any control with any style (for example, if you inherit it from ContentControl, you gets clear style without circle or other borders).
Nov 13, 2013 at 8:34 PM
Thanks! That helped alot. I simply disabled all circles. :)

Code below for anyone else that would like to do this. Simply use ApplicationBar2 instead of ApplicationBar.
    public class ApplicationBar2 : ApplicationBar
    {
        protected override bool IsItemItsOwnContainerOverride(object item)
        {
            return true;
        }
    }
Feb 20, 2014 at 11:00 PM
Edited Feb 21, 2014 at 12:47 PM
EDIT: Never mind my question. I think I messed up my namespaces. After correct the problem and restart VS, the error is gone.


Hello,
When I use the ApplicationBar2 posted above, I got following error in the XAML:
   The specified value cannot be assigned. The following type was expected: "ApplicationBar".
Following is the XAML causing the error, the error occurs on line 9. Any idea how to fix this?
1 <metro:Window
2       x:Class="WpfApplication3.Window1"
3       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5       xmlns:main="clr-namespace:WpfApplication3"
6       xmlns:metro="http://schemas.codeplex.com/elysium"
7        .... >
8       <metro:Window.ApplicationBar>
9         <main:ApplicationBar2 >
10       </main:ApplicationBar2>
11     </metro:Window.ApplicationBar>
12     ...
13 <metro:Window/>