Conditional property binding #3818
-
Hello! Slint supports nice ternary operator ... ? ... : ... for properties. Is there any way to have conditional property assignment? For example,
I can't use ternary operator in this case ( I also can't use callback for evaluating conditional statement, because I need it in resizing event (As far as I know, Slint does not firing resizing callbacks). The Conditional Element syntax ( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
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";
}
]
} |
Beta Was this translation helpful? Give feedback.
Could it be a solution to use the condition to trigger a state, which then does the desired binding? See an example here: