Comments (16)
I think the 'fault' is with MetroImage
, which is used internally by AppBarButton
. Frankly, I'm not a big fan of either, and they were submissions by somebody else.
Personally, I use the button/rectangle trick because it just works easier.
from mahapps.metro.
Thanks Paul
Do you know who pushed the feature. I think it would be good to either get them to fix it or have it withdrawn....
from mahapps.metro.
You're right Andrew, it either needs to work or not be there since it can't be used "by itself". I think this was introduced by @JakeGinnivan, I'll double check with him today.
from mahapps.metro.
While it turns out AppBarButton
is using the Rectangle/Visual thing, this bug is also present in MetroImage
from mahapps.metro.
I don't know if it will help Jake but when I was debugging through the code I noticed that the "set" for the MetroImage attribute was not being called.
from mahapps.metro.
another thing is when use the button/rectangle the icon of color can not change with button foreground
from mahapps.metro.
@jaohaohsuan this makes sense at the colors are defined already in the Resources library and not dynamically with button/rectangle style. This can be changed however currently it seems for me that the not-loading-issue might be related to the canvas being served from outer resource library in general. I have messed with this a while now and the only working solution has been to copy the canvas locally to rectangle fill tag. We'll see.......
from mahapps.metro.
I was able to work around this issue by defining the Colours.xaml
style in both the App.xaml and the Window using the MetroImage, Not sure why this works, but it does. Dynamic theme changes works with this as well.
App.xaml
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary x:Name="MetroIcons" Source="pack://application:,,,/YourNameSpace;component/Resources/Icons.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Window.xaml
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
from mahapps.metro.
@nCubed I don't think this is a workaround at all - all Canvas elements use DynamicResource colors which they don't have direct access to, so this must be referenced by the root classes of your project to provide the necessary link. I tried also to add the Colours.xaml reference to the Icons.xaml resources but no luck - so it must be done on the root level of the referencing project. This makes some sense to me at least :)
from mahapps.metro.
@sirWest - you are correct, I should have been more explicit. You need to include the relevant color schemes as in my example, not just Colours.xaml
.
However, after further testing, the dynamic theme changing doesn't work quite as expected in my example. I believe the complete resolution is to duplicate all the xaml color files in the Window
and the App.xaml
.
Not the greatest of resolutions. May just be a case where using the basic button styling in lieu of the AppBarButton
is the preferred method.
from mahapps.metro.
@nCubed On the demo app all themes are working for me when just including the Colours.xaml in App resources. What cases aren't working and what could be the differences in the surrounding app's environment?
from mahapps.metro.
@sirWest - sorry for the delayed response; been tied up. I'll test this further tomorrow and try to come up with the cases that are not working.
from mahapps.metro.
@sirWest - I threw together a demo app and re-tested everything. Indeed the work-around for this issue does appear to be to place Colours.xaml
in the app.config
.
I spent a bit of time on the source for AppBarButton
, but came up empty as to what the underlying issue is.
from mahapps.metro.
@nCubed I have fiddled with this issue also for a longer while without any other results what would indicate that something is actually broken. This can possibly only be related to some broken resource sharing. I just didn't think that such a simple fix will do it :)
from mahapps.metro.
Glad you guys are finding it difficult to pin down, I have also looked over the source of this stuff, it was supposed to make it easier and less xaml to use the images than the rectangle approach. Am sorry it has caused all these issues, but it looks like issues inside WPF's resource resolution which is the underlying cause of these issues =( I am short of time which is why I havenโt been posting much, but am following this issue with interest =)
Cheers,
Jake
-----Original Message-----
From: Tanel T [mailto:[email protected]]
Sent: Monday, 21 May 2012 11:54 PM
To: Jake Ginnivan
Subject: Re: [MahApps.Metro] AppBarButton does not load image (#41)
@nCubed I have fiddled with this issue also for a longer while without any other results what would indicate that something is actually broken. This can possibly only be related to some broken resource sharing. I just didn't think that such a simple fix will do it :)
Reply to this email directly or view it on GitHub:
#41 (comment)
from mahapps.metro.
Since we've been unable to solve this, AppBarButton
will be marked as Obsolete for 0.9, and removed by 1.0
from mahapps.metro.
Related Issues (20)
- It"s not a bug, I need some help to start !
- Unable to use Automation Peer on controls using Mahapps framework HOT 3
- Missing PART in the datagrid HOT 6
- Flyout overlapping to Menubar within the animation HOT 2
- Xaml warning: Resource '{x:Type MahApps.Metro.Controls.MetroWindow}' is not found HOT 4
- MultiSelectionComboBox / MultiSelectorHelper.SelectedItems one step behind
- The HamburgerMenu control uses the HamburgerMenuListBox control to show the menu items. You can use a DataTemplate with an Expander control with an HamburgerMenuListBox control as the Child to show submenu items:
- Add Filter Buttons in DataGridColumn Headers HOT 1
- MultiSelectorHelper.SelectedItems throws Exception when an Item is selected from a ListBox which is nested inside a ListView
- RoutedEventArgs is empty
- mahapps.metro is missing NuGet package README file
- Detected package version outside of dependency constraint: MahApps.Metro 2.4.10 requires ControlzEx (>= 4.4.0 && < 6.0.0) but version ControlzEx 6.0.0 was resolved. HOT 1
- Colon between Hour/Minute in TimePicker when PickerVisibility is set to Minute,Second
- Bindings are broken in SplitView
- The value of the ValueProperty of NumericUpDown gets lost during navigation
- 1NNAP4ZYwn63KHZXG5vPaP26W3ixdFSw45 #95943
- RichTextBox and Themes HOT 3
- MetroWindow : Unloaded event HOT 1
- Replace + and - for arrows in NumericUpDown HOT 3
- Style NumericUpDown Exception HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mahapps.metro.