<Application x:Class="StringFormatMVVM.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
              xmlns:mat="clr-namespace:Telerik.Windows.Controls.MaterialControls;assembly=Telerik.Windows.Controls"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="telerik:RadDateTimePicker" BasedOn="{StaticResource RadDateTimePickerStyle}">
                <Setter Property="Background" Value="Red" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="telerik:RadDateTimePicker">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="auto"/>
                                </Grid.ColumnDefinitions>
                                <Border x:Name="BorderVisual"
                                Grid.ColumnSpan="2"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"/>
                                <telerik:RadWatermarkTextBox x:Name="PART_DateTimeInput"
                                mat:MaterialAssist.FocusBrush="{x:Null}"
                                BorderBrush="{x:Null}"
                                Background="{x:Null}"
                                DisabledBackground="{x:Null}"
                                BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={StaticResource ThicknessToOrientedThicknessConverter}, ConverterParameter=BottomLeftTop}"
                                Text="{Binding DateTimeText, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                CurrentText="{Binding CurrentDateTimeText, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                IsReadOnly="{TemplateBinding IsReadOnly}"
                                Foreground="{TemplateBinding Foreground}"
                                VerticalAlignment="Stretch"
                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                WatermarkContent="{TemplateBinding DateTimeWatermarkContent}"
                                WatermarkTemplate="{TemplateBinding DateTimeWatermarkTemplate}"
                                TextAlignment="{TemplateBinding TextAlignment}"
                                TabIndex="0"
                                SelectionOnFocus="{TemplateBinding SelectionOnFocus}"
                                Padding="{TemplateBinding Padding}"
                                FontFamily="{telerik:FluentResource ResourceKey=FontFamily}"
                                FontSize="{TemplateBinding FontSize}"
                                Focusable="{TemplateBinding Focusable}"/>
                                <telerik:RadDropDownButton x:Name="PART_DropDownButton"
                                Grid.Column="1"
                                TabIndex="1"
                                Padding="0"
                                DropDownIndicatorVisibility="Collapsed"
                                BorderThickness="0"
                                BorderBrush="{x:Null}"
                                Background="{x:Null}"
                                PopupPlacementTarget="{Binding ElementName=PART_DateTimeInput}"
                                IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                CloseOnEnter="True"
                                IsTabStop="False"
                                HorizontalContentAlignment="Stretch"
                                VerticalContentAlignment="Stretch"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Stretch"
                                Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={StaticResource ThicknessToOrientedThicknessConverter}, ConverterParameter=TopRightBottom}"
                                Width="26"
                                telerik:DateTimePickerExtensions.FocusContentOnOpen="True"
                                Focusable="False">
                                    <telerik:RadDropDownButton.DropDownContent>
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition/>
                                                <RowDefinition/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <Border x:Name="BackgroundVisual" Grid.Row="0" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
                                            <telerik:RadCalendar x:Name="PART_Calendar"
                                            Grid.Column="0"
                                            Grid.Row="0"
                                            Background="{x:Null}"
                                            IsReadOnly="{TemplateBinding IsReadOnly}"
                                            DateSelectionMode="{TemplateBinding DateSelectionMode}"
                                            Culture="{TemplateBinding Culture}"
                                            SelectionMode="Single"
                                            Style="{TemplateBinding CalendarStyle}"
                                            DisplayDateStart="{Binding DisplayDateStart, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                            DisplayDate="{Binding DisplayDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                            DisplayDateEnd="{Binding DisplayDateEnd, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                            SelectableDateStart="{Binding SelectableDateStart, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                            SelectedDate="{Binding SelectedDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                            SelectableDateEnd="{Binding SelectableDateEnd, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                            BlackoutDates="{Binding BlackoutDates, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
                                            <telerik:DateTimePickerClock x:Name="PART_Clock"
                                            Grid.Column="1"
                                            Grid.Row="0"
                                            ItemsSource="{TemplateBinding ClockItemsSource}"
                                            StartTime="{TemplateBinding StartTime}"
                                            EndTime="{TemplateBinding EndTime}"
                                            TimeInterval="{Binding TimeInterval, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                            IsReadOnly="{TemplateBinding IsReadOnly}"
                                            Style="{TemplateBinding ClockStyle}"
                                            Culture="{TemplateBinding Culture}"
                                            SelectedItem="{Binding SelectedTime, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                                            <Border x:Name="CloseButtonContainer"
                                            Grid.Column="0"
                                            Grid.ColumnSpan="2"
                                            Grid.Row="1"
                                            telerik:TouchManager.TouchMode="None"
                                            Background="{telerik:FluentResource ResourceKey=MainBrush}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="2 0 2 2">
                                                <telerik:RadButton x:Name="PART_Close"
                                                TabIndex="2"
                                                IsTabStop="True"
                                                HorizontalAlignment="Right"
                                                telerik:LocalizationManager.ResourceKey="Close"
                                                Command="{x:Static telerik:RadDateTimePickerCommands.Close}"
                                                KeyboardNavigation.TabNavigation="Once"
                                                Margin="5 4"
                                                Padding="25 5"/>
                                            </Border>
                                            <Border x:Name="TodayButtonBorder"
                                            Grid.Row="1"
                                            Background="{telerik:FluentResource ResourceKey=MainBrush}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="2 0 2 2"
                                            SnapsToDevicePixels="True"
                                            Visibility="{TemplateBinding TodayButtonVisibility}">
                                                <telerik:RadButton x:Name="TodayButton"
                                                CornerRadius="0"
                                                IsBackgroundVisible="False"
                                                Command="{x:Static telerik:RadDateTimePickerCommands.SetToday}"
                                                BorderThickness="0"
                                                Margin="0"
                                                Padding="0"
                                                Content="{TemplateBinding TodayButtonContent}"/>
                                            </Border>
                                        </Grid>
                                    </telerik:RadDropDownButton.DropDownContent>
                                    <telerik:RadDropDownButton.Template>
                                        <ControlTemplate TargetType="telerik:RadDropDownButton">
                                            <Grid>
                                                <Border x:Name="Background">
                                                    <mat:FluentControl EffectMode="Glow" BorderThickness="0" IsSmartClipped="True">
                                                        <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                    </mat:FluentControl>
                                                </Border>
                                                <Popup x:Name="DropDownPopup"
                                                HorizontalOffset="0"
                                                VerticalOffset="1"
                                                AllowsTransparency="True"
                                                mat:ThemeEffectsHelper.IsAcrylic="True"
                                                StaysOpen="False"
                                                Focusable="false"
                                                Placement="Bottom"
                                                IsOpen="{Binding Path=IsOpen, RelativeSource={RelativeSource TemplatedParent}}">
                                                    <Grid x:Name="DropDownPopupGrid" Background="{telerik:FluentResource ResourceKey=PrimaryBackgroundBrush}">
                                                        <ContentPresenter x:Name="DropDownPopupContent"
                                                        Content="{TemplateBinding DropDownContent}"
                                                        ContentTemplate="{TemplateBinding DropDownContentTemplate}"
                                                        DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext}"/>
                                                    </Grid>
                                                </Popup>
                                            </Grid>
                                            <ControlTemplate.Triggers>
                                                <Trigger SourceName="DropDownPopup" Property="mat:ThemeEffectsHelper.IsAcrylic" Value="True">
                                                    <Setter TargetName="DropDownPopupGrid" Property="Background" Value="{Binding Source={StaticResource PrimaryBackgroundBrushProxy}, Path=ProxyValue, Converter={StaticResource OpacityConverter}, ConverterParameter=153}"/>
                                                </Trigger>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Background" TargetName="Background" Value="{telerik:FluentResource ResourceKey=MouseOverBrush}"/>
                                                </Trigger>
                                                <Trigger Property="IsPressed" Value="True">
                                                    <Setter Property="Background" TargetName="Background" Value="{telerik:FluentResource ResourceKey=PressedBrush}"/>
                                                </Trigger>
                                                <Trigger Property="IsOpen" Value="True">
                                                    <Setter Property="Background" TargetName="Background" Value="{telerik:FluentResource ResourceKey=PressedBrush}"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </telerik:RadDropDownButton.Template>
                                    <Grid>
                                        <Grid x:Name="DropDownIcon" Background="Transparent" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                            <telerik:RadGlyph x:Name="DateTimePickerIcon"
                                            Visibility="Collapsed"
                                            FontSize="16"
                                            Foreground="{telerik:FluentResource ResourceKey=IconBrush}"
                                            VerticalAlignment="Center"
                                            HorizontalAlignment="Center"
                                            Glyph="{StaticResource GlyphGrid}"
                                            FlowDirection="LeftToRight"/>
                                            <telerik:RadGlyph x:Name="CalendarIcon"
                                            Visibility="Collapsed"
                                            FontSize="16"
                                            Foreground="{telerik:FluentResource ResourceKey=IconBrush}"
                                            VerticalAlignment="Center"
                                            HorizontalAlignment="Center"
                                            Glyph="{StaticResource GlyphCalendar}"
                                            FlowDirection="LeftToRight"/>
                                            <telerik:RadGlyph x:Name="ClockIcon"
                                            Visibility="Collapsed"
                                            FontSize="16"
                                            Foreground="{telerik:FluentResource ResourceKey=IconBrush}"
                                            VerticalAlignment="Center"
                                            HorizontalAlignment="Center"
                                            Glyph="{StaticResource GlyphClock}"
                                            FlowDirection="LeftToRight"/>
                                        </Grid>
                                    </Grid>
                                </telerik:RadDropDownButton>
                                <Border x:Name="FocusVisual"
                                Background="{x:Null}"
                                IsHitTestVisible="False"
                                BorderBrush="{TemplateBinding mat:MaterialAssist.FocusBrush}"
                                BorderThickness="{telerik:FluentResource ResourceKey=FocusThickness}"
                                Visibility="Collapsed"
                                Grid.ColumnSpan="2"/>
                                <Border x:Name="ReadOnlyVisual"
                                Grid.ColumnSpan="2"
                                IsHitTestVisible="False"
                                Background="{telerik:FluentResource ResourceKey=ReadOnlyBackgroundBrush}"
                                BorderBrush="{telerik:FluentResource ResourceKey=ReadOnlyBorderBrush}"
                                BorderThickness="{telerik:FluentResource ResourceKey=FocusThickness}"
                                Visibility="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <Popup x:Name="PART_InputPopup"
                                telerik:PopupExtensions.IsOpen="{Binding IsTooltipOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                telerik:PopupExtensions.Placement="Top"
                                VerticalOffset="-2"
                                HorizontalOffset="-1"
                                telerik:PopupExtensions.PlacementTarget="{Binding ElementName=PART_DateTimeInput}"
                                telerik:PopupExtensions.Owner="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                StaysOpen="False"
                                AllowsTransparency="True">
                                    <ContentPresenter Content="{TemplateBinding TooltipContent}" ContentTemplate="{TemplateBinding TooltipTemplate}"/>
                                </Popup>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True" SourceName="PART_DateTimeInput">
                                    <Setter Property="Foreground" Value="{telerik:FluentResource ResourceKey=MarkerMouseOverBrush}"/>
                                </Trigger>
                                <Trigger Property="IsDropDownOpen" Value="True">
                                    <Setter Property="Foreground" Value="{telerik:FluentResource ResourceKey=MarkerMouseOverBrush}"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="DropDownIcon" Property="Opacity" Value="{telerik:FluentResource ResourceKey=DisabledOpacity}"/>
                                </Trigger>

                                <!-- Focused -->
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsKeyboardFocusWithin" Value="True"/>
                                        <Condition Property="IsOpen" SourceName="PART_DropDownButton" Value="False"/>
                                        <Condition Property="IsMouseOver" Value="False"/>
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="FocusVisual" Property="Visibility" Value="Visible"/>
                                    <Setter Property="Foreground" Value="{telerik:FluentResource ResourceKey=MarkerMouseOverBrush}"/>
                                </MultiTrigger>
                                <Trigger Property="IsKeyboardFocusWithin" Value="True" SourceName="PART_DateTimeInput">
                                    <Setter Property="Foreground" Value="{telerik:FluentResource ResourceKey=MarkerMouseOverBrush}"/>
                                </Trigger>
                                <Trigger Property="IsDropDownOpen" Value="True">
                                    <Setter Property="Foreground" Value="{telerik:FluentResource ResourceKey=MarkerBrush}"/>
                                </Trigger>
                                <Trigger Property="InputMode" Value="DateTimePicker">
                                    <Setter TargetName="DateTimePickerIcon" Property="Visibility" Value="Visible"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="InputMode" Value="DateTimePicker"/>
                                        <Condition Property="TodayButtonVisibility" Value="Visible"/>
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="CloseButtonContainer" Property="Grid.ColumnSpan" Value="1"/>
                                    <Setter TargetName="CloseButtonContainer" Property="Grid.Column" Value="1"/>
                                </MultiTrigger>
                                <Trigger Property="InputMode" Value="DatePicker">
                                    <Setter TargetName="PART_Clock" Property="Visibility" Value="Collapsed"/>
                                    <Setter TargetName="CalendarIcon" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="CloseButtonContainer" Property="Visibility" Value="Collapsed"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="InputMode" Value="DatePicker"/>
                                        <Condition Property="TodayButtonVisibility" Value="Visible"/>
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="TodayButtonBorder" Property="MinHeight" Value="36"/>
                                </MultiTrigger>
                                <Trigger Property="InputMode" Value="TimePicker">
                                    <Setter TargetName="PART_Calendar" Property="Visibility" Value="Collapsed"/>
                                    <Setter TargetName="ClockIcon" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="PART_Clock" Property="Margin" Value="0"/>
                                    <Setter TargetName="CloseButtonContainer" Property="Visibility" Value="Collapsed"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="InputMode" Value="TimePicker"/>
                                        <Condition Property="TodayButtonVisibility" Value="Visible"/>
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="TodayButtonBorder" Property="Grid.Column" Value="2"/>
                                    <Setter TargetName="TodayButtonBorder" Property="MinHeight" Value="36"/>
                                </MultiTrigger>
                                <Trigger Property="Validation.HasError" Value="True">
                                    <Setter TargetName="FocusVisual" Property="Visibility" Value="Collapsed"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>

    </Application.Resources>
</Application>
