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

change color of text when "MouseOver"

16 Answers 205 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
SIlvia
Top achievements
Rank 1
SIlvia asked on 08 Mar 2010, 04:39 PM
Hello,
how can i change Foreground of Text in an item in the MouseOver event?

Thanks,
Silvia

16 Answers, 1 is accepted

Sort by
0
SIlvia
Top achievements
Rank 1
answered on 09 Mar 2010, 04:28 PM
Sorry, but nobody can help me??
This is a big problem for me!
0
Dimitrina
Telerik team
answered on 10 Mar 2010, 08:38 AM
Hello SIlvia,

Unfortunately, it is not possible to change the foreground of the RadPanelBar because of the ContentPresenter it uses internally. The ContentPresenter itself does not expose a Foreground property.

Please find attached an example with a workaround.

Sincerely yours,
Dimitrina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
SIlvia
Top achievements
Rank 1
answered on 17 Mar 2010, 04:09 PM
Perfect, it is exactly what I wanted.
But what is the event associated with when I click with the left mouse button on the item?

Thanks again for the help

Silvia
0
Tihomir Petkov
Telerik team
answered on 17 Mar 2010, 04:24 PM
Hi SIlvia,

The event that will be fired is "Selected". You can see what events are thrown in our online demos:

http://demos.telerik.com/silverlight/#PanelBar/Event

All the best,
Tihomir Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
SIlvia
Top achievements
Rank 1
answered on 17 Mar 2010, 04:43 PM
Thank you, I solved everything.

Take advantage of your great kindness to make one last question.

I would like to slow down a little the expansion of the items panelbar, is it possible?

Thanks for all,
Silvia
0
Tihomir Petkov
Telerik team
answered on 18 Mar 2010, 12:29 PM
Hello SIlvia,

Currently only the  opacity of an item's content is animated and you can tweak its duration by editing the default control template. As for animating the expansion of an item (its height), this is currently not supported and there is no viable workaround for doing this on your own.

All the best,
Tihomir Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
SIlvia
Top achievements
Rank 1
answered on 19 Mar 2010, 01:01 PM
Oh, what a pity. Ok, no problem! The last question ... Hope!

I use the radPanelBar to make a menu with three levels where the headings (header) of items are centered.

You have an example to do this?

A panel bar (to use as menu) with 3 different level and each one with header in center?

Thans for all
Silvia
0
Tihomir Petkov
Telerik team
answered on 24 Mar 2010, 01:49 PM
Hi SIlvia,

Please take a look at the sample project I prepared for you and let me know if it helps. The project contains a PanelBar with a three-level hierarchy of items, each one of which has a centered header.

All the best,
Tihomir Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Berthold
Top achievements
Rank 1
answered on 30 Aug 2010, 07:56 AM
Hi, 
I've got a similar problem. 
I want to change the background of the selected item.

I use a HierarchicalDataTemplate
  <telerik:HierarchicalDataTemplate x:Key="NavigationTopItem" ItemsSource="{Binding SubItems}" ItemTemplate="{StaticResource NavigationSubItem1}">
            <TextBlock Text="{Binding Name}" Tag="{Binding Url}" FontWeight="Bold" Margin="10 4 0 4"/>
        </telerik:HierarchicalDataTemplate>

and a ItemContainerStyle:
<telerik:RadPanelBar Grid.Column="0" Grid.Row="1" Grid.RowSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Top" x:Name="SideNavigation"  BorderThickness="0" Margin="0,0,10,0"
                               ItemTemplate="{StaticResource NavigationTopItem}" ItemContainerStyle="{StaticResource SideMenubarHeader}" Selected="SideNavigation_Selected"/>

You wrote the foreground can't set directly through contentPresenter.
I wonder if it's possible to use not a Textblock but a UserControl who provide different states in order to change the forground. 
Any ideas?

Thanks for your help
Berthold 
0
Tina Stancheva
Telerik team
answered on 01 Sep 2010, 04:57 PM
Hi Berthold,

In order to change the background of the RadPanelBarItem, you can edit its ControlTemplate in ExpressionBlend. Here you can find more info about editing RadControls' ControlTemplates in ExpressionBlend.

Then you can simply change the Selected VisualState Brushes: ControlItem_OuterBorder_Selected, ControlItem_InnerBorder_Selected and ControlItem_Background_Selected.

As for the other question, you can indeed set a UserControl inside the HierarchicalDataTemplate and use its different states to change the forground.

I prepared a sample project illustrating this approach. Give it a try and let me know if this is what you hd in mind or if you need more info.


Kind regards,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Berthold
Top achievements
Rank 1
answered on 01 Sep 2010, 10:41 PM
Thanks, that helped me!
0
Chris
Top achievements
Rank 1
answered on 19 Oct 2010, 12:51 PM
Hey guys,

do you have any suggestions how i can achieve this for the PanelBarItem Header Foreground "FontWeight" property on item hover?

I got it to work like in the first sample project but all hirarchical PanelBarItems underneath the highlightet Item appearing in bold too.

An advice how to implement this feature in the template of the PanelBarItem would also be great.



Thanks in advance
0
Petar Mladenov
Telerik team
answered on 21 Oct 2010, 06:07 PM
Hi Chris,

The  property FontWeight  of the  RadPanelBarItem  affects its child elements and in Silverlight you cannot forbid this behavior with Interaction triggers. A possible workaround could be the use of  the MouseMove  event of the RadPanelBar. You can iterate through the children of the hovered RadPanelBarItem and reset their Fontweight.  

<telerikNavigation:RadPanelBar Name="panelBar"  MouseMove="panelBar_MouseMove">


private void panelBar_MouseMove(object sender, MouseEventArgs e)
       {
           RadPanelBarItem hoveredItem = (e.OriginalSource as Border).ParentOfType<RadPanelBarItem>();
  
           if (hoveredItem != null)
           {
               if (hoveredItem.Items != null)
               {
                   foreach (var item in hoveredItem.Items)
                   {
                       RadPanelBarItem childItem = item as RadPanelBarItem;
                       childItem.FontWeight = FontWeights.Normal;
 
                   }
               }
           }
       }


I hope this helps you. Feel free to ask if you need more info.

 

Sincerely yours,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris
Top achievements
Rank 1
answered on 22 Oct 2010, 07:52 AM
Hi Petar,

is there any solution how i can achieve this goal with "VisualStates" in the RadPanelBarItem or RadPanelBar Template?

Because i`m trying to deliver an already "finished" PanelBar to my developers so that they haven`t even to code something.

If there is no solution on this way i would prefer your suggested way. But wouldn´t be easier to set the only "FontWeight" of an specific RadPanelBarItem in code instead of your iterating trough the whole children and reset them? Or would it be the same result as it now is?

Thanks in advance.

Chris
0
Petar Mladenov
Telerik team
answered on 26 Oct 2010, 05:52 PM
Hello Chris,

 
We prepared a sample project demonstrating the functionality you want without using code behind.
We edited the ControlTemplate named  PanelBarItemTopLevelTemplate and added an ObjectAnimation targetting the Header`s FontWeight.

Please let me know if this satisfies your needs. We would be glad if we can further assist you.

Best wishes,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris
Top achievements
Rank 1
answered on 10 Nov 2010, 03:23 PM
Hello Petar,

i`m back from my vacation and would like to thank your for your sample.

I will check it immediately and will give you a response as soon as possible.

Thank you very much.

Regards

Chris
Tags
PanelBar
Asked by
SIlvia
Top achievements
Rank 1
Answers by
SIlvia
Top achievements
Rank 1
Dimitrina
Telerik team
Tihomir Petkov
Telerik team
Berthold
Top achievements
Rank 1
Tina Stancheva
Telerik team
Chris
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or