Page 1 of 1

Define behaviors in code

Posted: 21 May 2026, 14:55
by FrancoisRecisio
Hello ! :)

I would like to know if it's possible to access/modify a behavior from the code?
Specifically, I would like to be able to assign it dynamically in the code, based on certain conditions... But I haven't found any documentation on this.
<Border x:Class="xxx">
    <b:Interaction.Behaviors>
        <BackgroundEffectBehavior>
            <BlurEffect Radius="25" />
        </BackgroundEffectBehavior>
    </b:Interaction.Behaviors>
Thanks!

Re: Define behaviors in code

Posted: 22 May 2026, 19:12
by jsantos
Something like this should work
NoesisApp::BehaviorCollection* behaviors = NoesisApp::Interaction::GetBehaviors(border);
behaviors->Add(Noesis::MakePtr<BackgroundEffectBehavior>());

Re: Define behaviors in code

Posted: 25 May 2026, 16:27
by FrancoisRecisio
Thank you!