This is a migrated thread and some comments may be shown as answers.

Mouseover color effect is lost on color change

10 Answers 564 Views
Panorama
This is a migrated thread and some comments may be shown as answers.
Andre
Top achievements
Rank 1
Andre asked on 26 Jan 2013, 03:14 AM
When i change the color of the tile the default mouse-over color change effect disappears. How do i re enable this.

10 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Jan 2013, 11:10 AM
Hello Andre,

Thank you for writing.

Setting the BackColor of the TileElement in code has higher precedence than the theme and this is why the hover color is not applied. You have two options:
1. Modify the default theme and change the tile BackColor in it - see attached image demonstrating which repository you should modify. Here are some additional links that you might find useful:

2. Subscribe to the MouseEnter event of your tiles and when it occurs change the tile BackColor. Also, you will need to reset this setting when the MouseLeave event occurs:
void Form1_MouseLeave(object sender, EventArgs e)
{
    RadTileElement el = (RadTileElement)sender;
    el.BackColor = Color.Red;
}
 
void Form1_MouseEnter(object sender, EventArgs e)
{
    RadTileElement el = (RadTileElement)sender;
    el.BackColor = Color.Yellow;
}

I hope this helps.

Regards,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Stefan
Telerik team
answered on 30 Jan 2013, 12:21 PM
I forgot the attachment. Here is it.
 
Kind regards,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Andre
Top achievements
Rank 1
answered on 30 Jan 2013, 01:50 PM
Thanks. This is helpful. I'm trying to decide which way to go. I'd like to have tiles of various colors. Just so i understand correctly, if i went with your first suggestion, would i have to create several themes? ( One for each color? )

If so, maybe it'd be easier, if i did the color change in code like you suggest in option 2. 

Thanks again for your help.
0
Stefan
Telerik team
answered on 30 Jan 2013, 02:03 PM
Hello Andre,

If you want to have different colors for the different tiles, you should go with option 2 since in the theme you can set just the default color for all tiles used in RadPanorama.
 
Greetings,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Andre
Top achievements
Rank 1
answered on 30 Jan 2013, 02:16 PM
I don't see (attached) the mouse events for the tiles.
0
Andre
Top achievements
Rank 1
answered on 30 Jan 2013, 02:52 PM
Sorry, I looked into this a little further, I'll hook up the handlers in code i.e.

radTileElement1.MouseHover += new EventHandler(radTileElement1_MouseHover);

Thanks for all your help. Very responsive.
0
Andre
Top achievements
Rank 1
answered on 21 Feb 2013, 02:20 AM
There seems to be a problems with this solution when using groups. The mouseEnter event is triggered, but the mouseLeave event is not. 

Is this a know bug?
0
Stefan
Telerik team
answered on 25 Feb 2013, 11:29 AM
Hello Andre,

Thank you for writing back.

It seems that there is an issue with the MouseLeave event in this case. I will log it in our
Public Issue Tracking System and we will address it accordingly. Here is the link to it: http://www.telerik.com/support/pits.aspx#/public/winforms/14359.

Your Telerik Points have been updated for this report.

As a workaround, you can use the control's MouseMove event in the following manner:
RadTileElement saveTile;
      void radPanorama1_MouseMove(object sender, MouseEventArgs e)
      {
          RadTileElement tile = radPanorama1.ElementTree.GetElementAtPoint(e.Location) as RadTileElement;
          if (tile != null)
          {
              if (saveTile != null)
              {
                  saveTile.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
              }
 
              tile.BackColor = Color.Yellow;
              saveTile = tile;
          }
          else if (saveTile != null)
          {
              saveTile.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
          }
      }

I hope this helps.

Greetings,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Derek
Top achievements
Rank 1
answered on 17 Jun 2013, 02:06 PM
Stefan,

Thank you for the code. This is a nice work around for tiles that are in groups. However, this example voids the set backcolor for the tile once the mouse leaves the tile. So, the mouse will enter the tile for a nice scroll over effect, but then it resets the backcolor to the default blue for the control. Is there a way to go back to a set backcolor?

Thanks,

Derek
0
Stefan
Telerik team
answered on 20 Jun 2013, 11:22 AM
Hello,

No, there is no way to revert back to another locally set BackColor. What I can offer is to store the desired color for a tile in its Tag property and instead of using the reset, get the color from the Tag and set it instead.

I hope this will work for you.
 
Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
Panorama
Asked by
Andre
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Andre
Top achievements
Rank 1
Derek
Top achievements
Rank 1
Share this question
or