© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago
Elio

Custom ToggleButon WPF

https://paste.mod.gg/siztgxijeavn/1

Hello, i'm trying to make my own togglebutton because i want it to have the property
IscheckedLeft
IscheckedLeft
that allow me to easily switch the side of the checked value of my button. I've almost done it but i can't find a way to change my storyboard depends of
IscheckedLeft
IscheckedLeft
. Basically i would like to
Set this if
IscheckedLeft
IscheckedLeft
= false
<ThicknessAnimation
    Storyboard.TargetName="Thumb"
    Storyboard.TargetProperty="Margin"
    To="0 0 39 0"
    Duration="0:0:0.2" />
<ThicknessAnimation
    Storyboard.TargetName="Thumb"
    Storyboard.TargetProperty="Margin"
    To="0 0 39 0"
    Duration="0:0:0.2" />

and Set this if
IscheckedLeft
IscheckedLeft
= true
<ThicknessAnimation
    Storyboard.TargetName="Thumb"
    Storyboard.TargetProperty="Margin"
    To="39 0 0 0"
    Duration="0:0:0.2" />
<ThicknessAnimation
    Storyboard.TargetName="Thumb"
    Storyboard.TargetProperty="Margin"
    To="39 0 0 0"
    Duration="0:0:0.2" />

My problem there is if i use a converter the following error is triggered "Cannot freeze this Storyboard timeline tree for use across threads".
Have you any idea how i could do this ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ wpf custom window
C#CC# / help
3y ago
❔ wpf custom fonts
C#CC# / help
3y ago
✅ WPF UI (lepoco/wpfui) Questions
C#CC# / help
2y ago
WPF - Custom Control Help
C#CC# / help
15mo ago