Skip to content

How to bind StaticResource? #83

@xiaoxstz

Description

@xiaoxstz

Firstly, install the NuGet "MahApps.Metro.IconPacks.Material" and "CalcBinding"

Then, I defined two values in the header.

<UserControl.Resources>
    <iconPacks:PackIconMaterial x:Key="VideoIconOn" Kind="Video"/>
    <iconPacks:PackIconMaterial x:Key="VideoIconOff" Kind="VideoOff"/>
</UserControl.Resources>

The values can be used like below

<Button Command="{Binding ExecuteCommand}" CommandParameter="Video" ToolTip="Grab pictures continuously"
        Content="{StaticResource VideoIconOn}"/>

But, it cannot be used like below

<Button Command="{Binding ExecuteCommand}" CommandParameter="Video" ToolTip="Grab pictures continuously"
        Content="{calc:Binding IsVideoOpen?{StaticResource VideoIconOn}:{StaticResource VideoIconOff}}"/>

Why? How to use it correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions