Turn off highlighted or selected date style

9 posts, 1 answers
  1. Andrew
    Andrew avatar
    9 posts
    Member since:
    Aug 2014

    Posted 10 Aug Link to this post

    When I click a date on the calendar screen and then return to the calendar the date I just visited shows up on the calendar as having a orange box around it.  How do I turn this off?  I assume it is either the highlighted date or selected date property (http://docs.telerik.com/devtools/wpf/controls/radcalendar/structure) as both of those have the organge box i don't want to appear.

    Thank you for your help,
    Andrew

  2. Andrew
    Andrew avatar
    9 posts
    Member since:
    Aug 2014

    Posted 12 Aug in reply to Andrew Link to this post

    Would any more information about this question be helpful in answering it?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Masha
    Admin
    Masha avatar
    355 posts

    Posted 15 Aug Link to this post

    Hi Andrew,

    I guess you want to remove the focused border around calendar button. In order to achieve this you need to modify the control template of CalendarButtonStyle. Inside it look for Focused VisualState and remove the storyboard inside it. Also you need to set RenderFocused="False" of telerikChromes named SelectionChrome.

    I demonstrated this approach  in the attached project. Please note the project uses implicit styles and NoXaml binaries.

    I hope this helps.

    Regards,
    Masha
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  5. Andrew
    Andrew avatar
    9 posts
    Member since:
    Aug 2014

    Posted 16 Aug in reply to Masha Link to this post

    Thanks for helping Masha!

    I want to remove the orange box and the filled interior that is also a orange gradient.  In the example demo I ran it is still there? (see attached image)

    The orange box that shows up when you hover the mouse over the date is fine and can stay there.

    Thanks,

    Andrew

  6. Answer
    Masha
    Admin
    Masha avatar
    355 posts

    Posted 17 Aug Link to this post

    Hi Andrew,

    Simply set RenderHighlighted="False"  of ButtonChome named SelectionChrome inside CalendarButtonStyle. This way the mouse over border will disappear.

    I hope this helps.

    Regards,
    Masha
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  7. Andrew
    Andrew avatar
    9 posts
    Member since:
    Aug 2014

    Posted 17 Aug in reply to Masha Link to this post

    Hey Masha,

    Yes, you are correct - I change the RenderHighlighted to False and the mouse over border disappears.  That lead me right to what I was trying to ask about.  I changed RenderSelected="False" and everything works as I want.

    Thanks so much for your help,

    Andrew

  8. Andrew
    Andrew avatar
    9 posts
    Member since:
    Aug 2014

    Posted 17 Aug in reply to Andrew Link to this post

    One more question. In implementing this solution in my project I realized I use DayButtonStyleSelector class and went to implement your solution in the code file.  I beleive i have the correct render selected property set:

    Dim propStyleChrome As DependencyProperty = Telerik.Windows.Controls.Chromes.ButtonChrome.RenderSelectedProperty

    Dim TakencustomStyle As New Windows.Style
    TakencustomStyle.Setters.Add(New Setter(propStyleChrome, False))

    But that alone doesn't remove the selected box, i think i am missing the part of removing the VisualState of focused you have in your example:
     <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Unfocused"/>
                                            <VisualState x:Name="Focused">
                                                <!--<Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionChrome" Storyboard.TargetProperty="BorderThickness">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Thickness>1</Thickness>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>-->
                                            </VisualState>
                                        </VisualStateGroup>

    Is there a way to do this from a code behind?  Or what is a solution i could use to make this work when using a DayButtonStyleSelctor class and have the DayButtonStyle set to nothing.

  9. Andrew
    Andrew avatar
    9 posts
    Member since:
    Aug 2014

    Posted 17 Aug in reply to Andrew Link to this post

    You can disregard my last question above - I found a solution that works for me.  I added your xaml code as a application resource and then set the template property in DayButtonStyleSelctor class.

    Dim propStyleTemplate As DependencyProperty = Telerik.Windows.Controls.Calendar.CalendarButton.TemplateProperty

    TakencustomStyle.Setters.Add(New Setter(propStyleTemplate, DirectCast(Application.Current.Resources("calNoSelectStyle"), System.Windows.Controls.ControlTemplate)))

  10. Masha
    Admin
    Masha avatar
    355 posts

    Posted 18 Aug Link to this post

    Hi Andrew,

    I'm glad you were able to resolve the issue.

    If you have any other questions do not hesitate to contact us again.

    Regards,
    Masha
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready