Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Key styling (Read 1286 times)
TuanLe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Nov 7th, 2021
Key styling
Nov 26th, 2024 at 3:33am
Print Post  
Could I customize the style of a specific button?
For example in my use case, I would like to have a specific theme for the Enter button only.
Thanks.
  

keyboard.PNG ( 56 KB | 31 Downloads )
keyboard.PNG
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3371
Joined: Oct 19th, 2005
Re: Key styling
Reply #1 - Nov 26th, 2024 at 6:28am
Print Post  
If you already have a custom template for SpecialKey, try adding a DataTrigger to it:

<DataTrigger Binding="{Binding VirtualKey}" Value="13">

with property setters you need to customize for Enter inside.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
TuanLe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Nov 7th, 2021
Re: Key styling
Reply #2 - Nov 26th, 2024 at 7:03am
Print Post  
Thank @Slavcho
I saw that we have no property related to the background/foreground in the Key object.
So is there any way that I can update the background of the Key at runtime?
I have the use case that the background should be changed based on some runtime conditions.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3371
Joined: Oct 19th, 2005
Re: Key styling
Reply #3 - Nov 26th, 2024 at 7:15am
Print Post  
Hi,

If you can describe these conditions using a DataTrigger, set x:Name of your Border or Rectangle that renders the key background, and then the trigger's setters could specify TargetName:

<Setter TargetName="backRect" Property="Fill" Value="..." />

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3371
Joined: Oct 19th, 2005
Re: Key styling
Reply #4 - Nov 26th, 2024 at 7:19am
Print Post  
Alternatively have your template render background specified by a WPF attached property, and then change the attached property's value when you detect the conditions.
  
Back to top
 
IP Logged
 
TuanLe
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Nov 7th, 2021
Re: Key styling
Reply #5 - Nov 26th, 2024 at 7:32am
Print Post  
Thanks for your support @Slavcho
I will try both of them.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint