logo
down
shadow

I Don't want message "SELECT DATE" in DatePicker


I Don't want message "SELECT DATE" in DatePicker

By : Joe Ndugga
Date : November 22 2020, 10:33 AM
wish of those help You can modify the default template for the DatePickerTextBox
The thing to change is the 'PART_Watermark' ContentControl. The code for the DatePicker sets the Content property of this control, so we can't just change the Content. Instead override the ControlTemplate for this control and just make it a TextBlock with the text you want.
code :
<ContentControl x:Name="PART_Watermark"
                    Opacity="0"
                    Focusable="False"
                    IsHitTestVisible="False"
                    Padding="2">
    <ContentControl.Template>
        <ControlTemplate>
            <TextBlock Text="//____"/>
        </ControlTemplate>
    </ContentControl.Template>
</ContentControl>
<Style TargetType="{x:Type DatePickerTextBox}">
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
    <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
    <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="DatePickerTextBox">
                <Grid>
                    <Grid.Resources>
                        <SolidColorBrush x:Key="WatermarkBrush" Color="#FFAAAAAA"/>
                    </Grid.Resources>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup Name="CommonStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="0" />
                                <VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                            </VisualStateGroup.Transitions>
                            <VisualState Name="Normal" />
                            <VisualState Name="MouseOver">
                                <Storyboard>
                                    <ColorAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
                                    <ColorAnimation Storyboard.TargetName="watermark_decorator" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup Name="WatermarkStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="0" />
                            </VisualStateGroup.Transitions>
                            <VisualState Name="Unwatermarked" />
                            <VisualState Name="Watermarked">
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                    <DoubleAnimation Storyboard.TargetName="PART_Watermark" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup Name="FocusStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="0" />
                            </VisualStateGroup.Transitions>
                            <VisualState Name="Unfocused" />
                            <VisualState Name="Focused">
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>


                    <Border x:Name="Border" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            CornerRadius="1" 
                            Opacity="1">
                        <Grid x:Name="WatermarkContent"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Border x:Name="ContentElement" BorderThickness="1">
                                <Border.BorderBrush>
                                    <SolidColorBrush Color="#FFFFFFFF"/>
                                </Border.BorderBrush>
                            </Border>
                            <Border x:Name="watermark_decorator" BorderThickness="1">
                                <Border.BorderBrush>
                                    <SolidColorBrush Color="#FFFFFFFF"/>
                                </Border.BorderBrush>
                                <ContentControl x:Name="PART_Watermark"
                                                    Opacity="0"
                                                    Focusable="False"
                                                    IsHitTestVisible="False"
                                                    Padding="2">
                                    <ContentControl.Template>
                                        <ControlTemplate>
                                            <TextBlock Text="//____"/>
                                        </ControlTemplate>
                                    </ContentControl.Template>
                                </ContentControl>
                            </Border>
                            <ScrollViewer x:Name="PART_ContentHost" 
                                          Margin="0"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                            <Border x:Name="FocusVisual" BorderBrush="#FF45D6FA" CornerRadius="1" Opacity="0" IsHitTestVisible="False"/>
                        </Grid>
                    </Border>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>


Share : facebook icon twitter icon
Bootstrap datepicker Keyboard navigation : select date when "tabbing out"

Bootstrap datepicker Keyboard navigation : select date when "tabbing out"


By : Habil Tosun
Date : March 29 2020, 07:55 AM
Does that help There is no out-of-the-box solution to this. You have to code this functionally yourself. Add a key-listener Event to the datepicker and check if "tab" (keycode = 9) is pressed. If tab is pressed, set the datepicker with the new value
Sorry that I can't give you a working example but there is no simple, short solution to it.
How to change message "Invalid Date" in ngx bootstrap datepicker without being in node modules

How to change message "Invalid Date" in ngx bootstrap datepicker without being in node modules


By : user801225
Date : March 29 2020, 07:55 AM
wish of those help I finally managed to do it :
You can import your LocaleData object and the function defineLocale:
code :
import {enGbLocale} from 'ngx-bootstrap/locale';
import {BsLocaleService, defineLocale} from 'ngx-bootstrap';
constructor(private localeService: BsLocaleService) {
    enGbLocale.invalidDate = 'Custom label';
    defineLocale('custom locale', enGbLocale); 
    this.localeService.use('custom locale');
}
"status":400,"error":"Bad Request","message":"Required Date parameter 'end'

"status":400,"error":"Bad Request","message":"Required Date parameter 'end'


By : Kedla
Date : March 29 2020, 07:55 AM
will help you Basically you are not suppling DateFormat without which String cannot be converted to date.
Use @DateTimeFormat("yyyy-MM-dd") like :
code :
@GetMapping("/findWithRange")
public ResponseEntity<List<Appointment>> findAllWithCreationRange(@RequestParam("start") @DateTimeFormat("yyyy-MM-dd") Date start, @RequestParam("end") @DateTimeFormat("yyyy-MM-dd") Date end) {

    List<Appointment> appointments = service.findAllWithCreationRange(start, end);

    if (Objects.isNull(appointments)) {
        ResponseEntity.badRequest().build();
    }

    return ResponseEntity.ok(appointments);
}
Is there a way to change the text displayed in a DatePicker? Instead of "Select a date", show something else?

Is there a way to change the text displayed in a DatePicker? Instead of "Select a date", show something else?


By : user2909785
Date : March 29 2020, 07:55 AM
this will help You could define an implicit DatePickerTextBox style where you hide the ContentControl named "PART_Watermark" and add a TextBlock with your custom text:
code :
<DatePicker Height="28" HorizontalAlignment="Left" Margin="515,55.661,0,0" Name="dtpStartDate"
            VerticalAlignment="Top" Width="180" FontSize="16" Background="White" 
            SelectedDateFormat="Short" TabIndex="20">
    <DatePicker.Resources>
        <Style TargetType="DatePickerTextBox">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DatePickerTextBox}">
                        <Grid>
                            <Grid.Resources>
                                <SolidColorBrush x:Key="WatermarkBrush" Color="#FFAAAAAA"/>
                            </Grid.Resources>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0"/>
                                        <VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" To="#FF99C1E2" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ContentElement"/>
                                            <ColorAnimation Duration="0" To="#FF99C1E2" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="watermark_decorator"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="WatermarkStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Unwatermarked"/>
                                    <VisualState x:Name="Watermarked">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentElement"/>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Watermark"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1" Opacity="1" Padding="{TemplateBinding Padding}">
                                <Grid x:Name="WatermarkContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <Border x:Name="ContentElement" BorderBrush="#FFFFFFFF" BorderThickness="1"/>
                                    <Border x:Name="watermark_decorator" BorderBrush="#FFFFFFFF" BorderThickness="1">
                                        <Grid>
                                            <ContentControl x:Name="PART_Watermark" Focusable="False" IsHitTestVisible="False" Opacity="0" Padding="2" Visibility="Collapsed"/>
                                            <TextBlock Text="custom..." />
                                        </Grid>
                                    </Border>
                                    <ScrollViewer x:Name="PART_ContentHost" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    <Border x:Name="FocusVisual" BorderBrush="#FF45D6FA" CornerRadius="1" IsHitTestVisible="False" Opacity="0"/>
                                </Grid>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </DatePicker.Resources>
</DatePicker>
<TextBlock Text="{x:Static local:AppResources.HelloWorld}" /> 
<TextBlock Text="{x:Static local:AppResources.HelloWorld}">
    <TextBlock.Style>
        <Style TargetType="TextBlock">
            <Setter Property="Visibility" Value="Collapsed" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding SelectedDate, RelativeSource={RelativeSource AncestorType=DatePicker}}" 
                             Value="{x:Null}">
                    <Setter Property="Visibility" Value="Visible" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </TextBlock.Style>
</TextBlock>
JQuery-UI datepicker bugs out when I hack the "today" button to also select the date but only in IE

JQuery-UI datepicker bugs out when I hack the "today" button to also select the date but only in IE


By : kassy
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I've used various "fixes" to make the today button also select the date and so far all of them worked nicely on Firefox but IE bugs out when I use them. Whenever I click today, the date gets selected, the input field updated and the datepicker closed but IE imediately opens another datepicker that can't be closed unless you open a new datepicker. , For me, this one works, also in IE:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org