Skip to content

Conditional property binding #3818

Answered by bjorn
HitecExports asked this question in Q&A
Oct 31, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Could it be a solution to use the condition to trigger a state, which then does the desired binding? See an example here:

import { Button, VerticalBox } from "std-widgets.slint";
export component Demo {
    text-item := Text {
        font-size: 24px;
        horizontal-alignment: center;
    }

    states [
        bind-text when true: {
            text-item.text: "Hello World";
        }
    ]
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@HitecExports
Comment options

@bjorn
Comment options

@HitecExports
Comment options

Answer selected by HitecExports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants