change color of text when "MouseOver"

17 posts, 0 answers
  1. SIlvia
    SIlvia avatar
    25 posts
    Member since:
    Apr 2009

    Posted 08 Mar 2010 Link to this post

    Hello,
    how can i change Foreground of Text in an item in the MouseOver event?

    Thanks,
    Silvia
  2. SIlvia
    SIlvia avatar
    25 posts
    Member since:
    Apr 2009

    Posted 09 Mar 2010 Link to this post

    Sorry, but nobody can help me??
    This is a big problem for me!
  3. DevCraft banner
  4. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 10 Mar 2010 Link to this post

    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.
  5. SIlvia
    SIlvia avatar
    25 posts
    Member since:
    Apr 2009

    Posted 17 Mar 2010 Link to this post

    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
  6. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 17 Mar 2010 Link to this post

    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.
  7. SIlvia
    SIlvia avatar
    25 posts
    Member since:
    Apr 2009

    Posted 17 Mar 2010 Link to this post

    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
  8. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 18 Mar 2010 Link to this post

    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.
  9. SIlvia
    SIlvia avatar
    25 posts
    Member since:
    Apr 2009

    Posted 19 Mar 2010 Link to this post

    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
  10. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 24 Mar 2010 Link to this post

    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.
  11. Berthold
    Berthold avatar
    38 posts
    Member since:
    Jul 2010

    Posted 30 Aug 2010 Link to this post

    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 
  12. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 01 Sep 2010 Link to this post

    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
  13. Berthold
    Berthold avatar
    38 posts
    Member since:
    Jul 2010

    Posted 01 Sep 2010 Link to this post

    Thanks, that helped me!
  14. Chris
    Chris avatar
    26 posts
    Member since:
    Jun 2010

    Posted 19 Oct 2010 Link to this post

    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
  15. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Oct 2010 Link to this post

    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
  16. Chris
    Chris avatar
    26 posts
    Member since:
    Jun 2010

    Posted 22 Oct 2010 Link to this post

    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
  17. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 26 Oct 2010 Link to this post

    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
  18. Chris
    Chris avatar
    26 posts
    Member since:
    Jun 2010

    Posted 10 Nov 2010 Link to this post

    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
Back to Top
DevCraft banner