Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
Changing XamMonthEditor properties for XamDateTimeEditor?
posted

 

When using XamDateTimeEditor how do I set the parameters of the underlying XamMonthEditor?
Specifically, I'd like to  display the week number and supress the TodayButton. 

I can do this in a XamMonthEditor but how do I connect this to the XamDateTimeEditor?

 

Thanks,

- Dave

  • 54937
    Verified Answer
    Offline posted

    The xamDateTimeEditor doesn't really know about the xamMonthCalendar that happens to be contained within its default template. That being said I can think of two options. One would be to retemplate the xamDateTimeEditor and set local values on the xamMonthCalendar within the template. Another way would be to put a Style that targets the xamMonthCalendar into the resources of the xamDateTimeEditor. e.g.

        <igEditors:XamDateTimeEditor.Resources>
            <Style TargetType="{x:Type igEditors:XamMonthCalendar}">
                <Setter Property="WeekNumberVisibility" Value="Visible" />
                <Setter Property="TodayButtonVisibility" Value="Collapsed" />
            </Style>
        </igEditors:XamDateTimeEditor.Resources>

     

  • 69686
    posted

    Hello Dave,

    Regarding the TodayButton, you have to retemplate the XamDateTimeEditor. You can see the default style for it in the DefaultStyles directory in the Infragistics folder.

    There you will find a style for the TodayButton:

    <Style TargetType="{x:Type Button}" x:Key="{x:Static igEditors:XamMonthCalendar.TodayButtonStyleKey}">

    and you probably need to restyle the XamMonthCalendar to hide its TodayButton, too

    ...

     <DockPanel SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">

                                            <!-- Today button -->

                                            <Button DockPanel.Dock="Bottom" Visibility="Collapsed"

                                    Style="{DynamicResource {x:Static igEditors:XamMonthCalendar.TodayButtonStyleKey}}"  

                                     />

    ...

    What exactly parameters do you need to pass to the XamMonthEditor? You can use these styles and use TemplateBindings.

    Regards,

    Alex.