Changing Card border color when clicked (using binding)

Hello, I'm not having any success getting it to change the border color if a card item is clicked. 

I looked at your other code examples and tried both the event handler and setter route as well as binding. My preference is to use binding to a property rather than an event handler.

I was able to getting the border to change dynamically - from black to red  - by binding the BorderBrush to the IsMouseOver event in my Card Template as shown here, and it snaps back to black when the mouse leaves the card.  However with other properties such as IsFocused and IsMouseCaptured these have no effect.

BorderBrush="{Binding IsMouseOver, Converter={StaticResource HighlightConverter}, Mode=OneWay, RelativeSource={RelativeSource Self}}"

Also if I tried the event handler approach, it doesn't seem possible to set the Border color that way.  The following code does not change the border color.

  private void KbBoard_CardTapped(object sender, Syncfusion.UI.Xaml.Kanban.KanbanTappedEventArgs e)
        {
            e.SelectedCard.BorderBrush = Brushes.Red;                    
        }

Any suggestions?

7 Replies

SG Sridharan Gajendran Syncfusion Team October 26, 2017 11:44 AM UTC

Hi Milan, 

Thanks for contacting Syncfusion Support. 

We are able to change the card’s border brush by customizing the CardTemplate property in the SfKanban. Please find the demo sample from the following link. 

Sample: KanbanDemo 

Regards, 
Sridharan 



MD Milan Danrel November 2, 2017 02:49 PM UTC

Thanks for providing the example. It does change the card border color, but the color does not revert back to its original state if another card is selected. So I don't think
your implementation (binding to the Tag.Borderbrush on the TemplatedParent) is the way to go. 

Any suggestions?



SG Sridharan Gajendran Syncfusion Team November 3, 2017 09:58 AM UTC

Hi Milan, 

We have reset the border brush for the previous selected card in the same demo sample. Please find the modified demo sample from the below link. 

Sample: KanbanDemo 

Thanks, 
Sridharan 



MD Milan Danrel November 3, 2017 10:50 AM UTC

Thanks again for the quick reply, I think this will work.  I was hoping for something that would avoid code-behind but this seems much simpler.



SG Sridharan Gajendran Syncfusion Team November 4, 2017 05:39 AM UTC

Hi Milan, 
 
Thanks for the response and please get back to us if you need any other assistance.   
We would be happy to help you out.   
  
Regards,   
Sridharan  



MA Manuel Alvarez June 29, 2018 03:38 PM UTC

Is there any option to set a border brush from start (by default) but keeping the option of new color on clicked? (like when the binding is set to cardstyle)
With the new binding the border is transparent until you click it.

Thanks


SG Sridharan Gajendran Syncfusion Team July 2, 2018 09:47 AM UTC

Hi Manuel, 

Thanks for contacting Syncfusion Support. 

We have achieved your requirement in the sample level by using custom column and customizing the card template. Please find the sample from the below location.  

Sample: KanbanDemo 
 
Regards, 
Sridharan 


Loader.
Up arrow icon