Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to bind StaticResource? #83

Open
xiaoxstz opened this issue Aug 9, 2023 · 0 comments
Open

How to bind StaticResource? #83

xiaoxstz opened this issue Aug 9, 2023 · 0 comments

Comments

@xiaoxstz
Copy link

xiaoxstz commented Aug 9, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant