Hello Di Wu,
Thank you for writing.
The best way to solve this issue is to customize the button layout in the theme you are using. To do that, you need to
open the theme with
Visual Style Builder, and then navigate to
RadButton -
RadButtonElement -
ButtonBorder and set the
InnerColor to transparent in the
RadButtonElement.
IsDefault state. After that you may export it to a new location and
use it from there. This is the code you will have to change:
I have also attached the theme so you may use it if you wish.
If you however need to use code then you will have to change several properties and subscribe for two events. You will have to remove the
BackgroundShape = null. Set the
BorderVisibility to
true. Set the desired
BorderColor and set some
BorderRadius. After that you will have to subscribe to the
MouseEnter and
MouseLeave events and change the
BorderColor when the corresponding event occurs. But even after doing all of these you will experience undesired behavior when you move the mouse out of the button with the mouse key pressed. You will notice that the border would not change its color until you release the mouse button.
Please feel free to use the way that suits your needs the most.
I have attached a project where you may see everything in action. The second option has been commented so please feel free to remove the uncomment it and check how it behaves.
Hope this helps. Please do not hesitate to contact us, should you have any further questions.
Greetings,
Paul
the Telerik team