Ticket Q551549
Visible to All Users

DateNavigator: SpecialDates with multiple colors

created 11 years ago

Hi,

i want to colorize the special dates in the DateNavigator with different specific colors.
Their is an example project attached to this question.

Actually it is no problem to colorize them intialy with a ControlTemplate for the DateNavigatorCalendarCellButton and a Converter.
The Converter checks the date of the CellButon and
sets the specific color.
My Converter expects a IDayColorizer Object as value parameter to call the extern colorization logic.
In the example it is the Window itself.

But the CellButtons loose their colors after a change of the current month in the DateNavigator.
The Converter is not called again.
I tried different approaches (Style, DataTrigger, Converter in ContentContainer) but the behaviour is still the same.
So i missed something but i can't image where the problem is.

Thank You.

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi Enis,
This behavior is expected. To update the multi-binding, you need to add at least one condition to the dynamic property. For example, modify your binding and converters in the following manner:

XAML
<DataTrigger Value="True" > <DataTrigger.Binding> <MultiBinding Converter="{local:CellConverter}"> <Binding Path="(dxe:DateNavigator.Navigator).SpecialDates" RelativeSource="{RelativeSource Self}"/> <Binding Path="(dxednc:DateNavigatorCalendar.DateTime)" RelativeSource="{RelativeSource Self}"/> </MultiBinding> </DataTrigger.Binding> <Setter TargetName="ContentSpecial" Property="ForegroundSolidColor1" > <Setter.Value> <MultiBinding Converter="{StaticResource WorktimeColorConverter}" ConverterParameter="Foreground"> <Binding RelativeSource="{RelativeSource TemplatedParent}" /> <Binding Path="." /> <Binding Path="(dxednc:DateNavigatorCalendar.DateTime)" RelativeSource="{RelativeSource Self}" /> </MultiBinding> </Setter.Value> </Setter> <Setter TargetName="BorderSpecial" Property="Background" > <Setter.Value> <MultiBinding Converter="{StaticResource WorktimeColorConverter}" ConverterParameter="Background"> <Binding RelativeSource="{RelativeSource TemplatedParent}" /> <Binding Path="." /> <Binding Path="(dxednc:DateNavigatorCalendar.DateTime)" RelativeSource="{RelativeSource Self}" /> </MultiBinding> </Setter.Value> </Setter> </DataTrigger>
C#
public class CellConverter : MarkupExtension, IMultiValueConverter { public CellConverter() { } public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var dt = (DateTime)values[1]; IList<DateTime> spD = (IList<DateTime>)values[0]; return spD != null && spD.Contains(dt); }
C#
public class WorktimeColorConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { if (values.Count() >= 2) {
    Show previous comments (1)
    DevExpress Support Team 11 years ago

      You are welcome, Enis.
      Feel free to contact us should you need further assistance.

        Hello! Please help!

        There is an error in the example.

        PrintScreen_1.png (Start project) clicks two months ago.

        Result error:  PrintScreen_2.png

        How to fix the error coloring?

        DevExpress Support Team 8 years ago

          Hello Ilya,

          I've created a separate ticket on your behalf (T464834: DateNavigator: SpecialDates with multiple colors in version 14.1.8). It has been placed in our processing queue and will be answered shortly.

          Thanks,
          Elliot

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.