Hi,
Sorry to put that as an issue, as it certainly link to my knowledge, but I can't find a way to create a style for PackIcon in my application.
Here is what I try to do:
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
<Style x:Key="test" TargetType="{x:Type materialDesign:PackIcon}">
<Setter Property="Height" Value="5" />
</Style>
When doing that I have an error saying:
PackIconExtension must inherit from FrameworkElement or FrameworkContentElement.
I have not clue why it is puttint the error on the extension and not packicon itself.
Thanks for your feedback.
Firstly, you probably want to add this: BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}"
Is the error at design time or compile time?
Yeah, for the basedon, I know that I should do it, but it's the same error.
it's a design time error.
In runtime, the style is ignored.
I made another test.
The style is applied in runtime. It's just a design time error.
Any hints?
Thanks,
Visual Studio. Designer...it's not perfect...
@elvince The problem here is again the VS designer which doesn't get the real control behind the PackIcon class cause the base class is PackIconBase
Thanks for your feeback.
I spent 3 hours on this to avoid this design errors. It's a mess.
Does vs2017 improved this?
@elvince Same happens in VS 2017
<Style TargetType="material:PackIcon">
or
<Style x:Key="materialPackIcon" TargetType="{x:Type controlzEx:PackIconBase}">
They don't happen error.
But you can't use :BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}".
It is mainly because there is something wrong in Nuget Configuration about “MaterialDesignThemes.Wpf”
Most helpful comment
<Style TargetType="material:PackIcon">or
<Style x:Key="materialPackIcon" TargetType="{x:Type controlzEx:PackIconBase}">They don't happen error.
But you can't use :
BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}".