Telerik Forums
UI for Xamarin Forum
1 answer
74 views
Hello, please can you help me understand why RadDateTimePicker popUp does not work for IOS. On Android working perfectly.
Didi
Telerik team
 answered on 22 Jul 2022
1 answer
54 views
This page jumps out through a button, await navigation PushAsync(new MyKPIMain());  No matter what I click on the time control, there is no response,. But if I don't jump to public app() {initializecomponent(); mainpage = newmykpimain();
}In the case of direct access, it is normal to click the control.

 

Yana
Telerik team
 answered on 06 May 2022
0 answers
40 views

<Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="42"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.1*"></ColumnDefinition>
                <ColumnDefinition Width="3.5*"></ColumnDefinition>
                <ColumnDefinition Width="0.8*"></ColumnDefinition>
                <ColumnDefinition Width="3.5*"></ColumnDefinition>
                <ColumnDefinition Width="2*"></ColumnDefinition>
                <ColumnDefinition Width="0.1*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid Grid.Row="0" Grid.Column="1">
                <telerikInput:RadDateTimePicker SpinnerFormat="yyyy-MM-dd HH:mm:ss" x:Name="StarDateTime" 
                                PlaceholderTemplate="{StaticResource placeholderTemplateStar}"
                                DisplayTemplate="{StaticResource displayTemplate}">
                    <telerikInput:RadDateTimePicker.SelectorSettings>
                        <telerikInput:PickerPopupSelectorSettings HeaderTemplate="{StaticResource headerTemplate}" 
                                                  FooterTemplate="{StaticResource footerTemplate}" />
                    </telerikInput:RadDateTimePicker.SelectorSettings>
                </telerikInput:RadDateTimePicker>
            </Grid>
            <Grid Grid.Row="0" Grid.Column="2">
                <Label VerticalTextAlignment="Center" HorizontalTextAlignment="Center" Text="---" />
            </Grid>
            <Grid Grid.Row="0" Grid.Column="3">
                <telerikInput:RadDateTimePicker SpinnerFormat="yyyy-MM-dd HH:mm:ss" x:Name="EndDateTime" 
                                PlaceholderTemplate="{StaticResource placeholderTemplateEnd}"
                                DisplayTemplate="{StaticResource displayTemplate}">
                    <telerikInput:RadDateTimePicker.SelectorSettings>
                        <telerikInput:PickerPopupSelectorSettings HeaderTemplate="{StaticResource headerTemplate}" 
                                                  FooterTemplate="{StaticResource footerTemplate}"/>
                    </telerikInput:RadDateTimePicker.SelectorSettings>
                </telerikInput:RadDateTimePicker>
            </Grid>
            <Grid Grid.Row="0" Grid.Column="4">
                <telerikInput:RadButton Text="计算" CornerRadius="20" Clicked="RadButton_Clicked" Style="{StaticResource BtnSubStyle}" />
            </Grid>

        </Grid>

 

--样式

<ControlTemplate x:Key="placeholderTemplateStar">
        <Label Text="请选择开始时间" 
           FontAttributes="Bold" 
           BackgroundColor="Black" 
           HeightRequest="50"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" />
            </Label.GestureRecognizers>
        </Label>
    </ControlTemplate>
    <ControlTemplate x:Key="placeholderTemplateEnd">
        <Label Text="请选择结束时间" 
           FontAttributes="Bold" 
           BackgroundColor="Black" 
           HeightRequest="50"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" />
            </Label.GestureRecognizers>
        </Label>
    </ControlTemplate>
    <ControlTemplate x:Key="displayTemplate">
        <Label Text="{TemplateBinding DisplayString}" 
           TextColor="Black" 
           HeightRequest="50"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" />
            </Label.GestureRecognizers>
        </Label>
    </ControlTemplate>

<ControlTemplate x:Key="headerTemplate">
        <Label Text="{TemplateBinding HeaderLabelText}" 
           TextColor="Black"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center"/>
    </ControlTemplate>
    <ControlTemplate x:Key="footerTemplate">
        <StackLayout Orientation="Horizontal" Spacing="0" HorizontalOptions="FillAndExpand">
            <Button Text="{TemplateBinding CancelButtonText}" 
                TextColor="Black"
                BackgroundColor="Transparent"
                Command="{TemplateBinding CancelCommand}" />
            <Button Text="{TemplateBinding AcceptButtonText}" 
                TextColor="Black"
                BackgroundColor="Transparent"
                Command="{TemplateBinding AcceptCommand}" />
        </StackLayout>

    </ControlTemplate>

--英文改为中文

public class CustomDateTimePickerLocalizationManager: TelerikLocalizationManager
{
        public override string GetString(string key)
        {

            if (key == "DateTimePicker_Popup_HeaderLabelText")
                return "Datum und Uhrzeit Picker";
            if (key == "DateTimePicker_PlaceholderLabelText")
                return "Datum und Uhrzeit auswählen";
            if (key == "Picker_AmPmSpinnerHeaderLabelText")
                return "am/pm";
            if (key == "Picker_DaySpinnerHeaderLabelText")
                return "日";
            if (key == "Picker_HourSpinnerHeaderLabelText")
                return "小时";
            if (key == "Picker_MinuteSpinnerHeaderLabelText")
                return "分";
            if (key == "Picker_SecondSpinnerHeaderLabelText")
                return "秒";
            if (key == "Picker_MonthSpinnerHeaderLabelText")
                return "月";
            if (key == "Picker_YearSpinnerHeaderLabelText")
                return "年";
            if (key == "Picker_Popup_AcceptButtonText")
                return "选择";
            if (key == "Picker_Popup_CancelButtonText")
                return "关闭";

            return base.GetString(key);
        }
    }

--后端

InitializeComponent();
            TelerikLocalizationManager.Manager = new CustomDateTimePickerLocalizationManager();
            StarDateTime.MinimumDate = DateTime.Now.AddYears(-10);
            EndDateTime.MinimumDate = DateTime.Now.AddYears(-10);
            StarDateTime.Date = DateTime.Now.AddYears(-1);
            EndDateTime.Date = DateTime.Now;
li
Top achievements
Rank 1
Iron
 asked on 29 Apr 2022
1 answer
2.4K+ views

Since adding the Telerik date picker control - we are getting an intermittent error:

 

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.PopupWindow'.

 

Call Stack below:

 

JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
PopupWindow.set_ContentView (Android.Views.View value)
RadPopup.ClearAndroidContext ()
RadPopup.UpdatePopupContext ()
RadPopup.OnPlacementTargetRendererChanged ()
PopupBase.PlacementTarget_PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e)
PopupBase+<>c.<AttachWeakEventListenerForPlacementTargetPropertyChanged>b__99_0 (Telerik.XamarinForms.Primitives.PopupBase listener, System.Object sender, System.ComponentModel.PropertyChangedEventArgs eventArgs)
WeakEventListener`3[TListener,TEventSource,TEventArgs].OnEvent (System.Object sender, TEventArgs eventArgs)
(wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
BindableObject.OnPropertyChanged (System.String propertyName)
Element.OnPropertyChanged (System.String propertyName)
BindableObject.ClearValue (Xamarin.Forms.BindableProperty property, System.Boolean fromStyle, System.Boolean checkAccess)
BindableObject.ClearValue (Xamarin.Forms.BindableProperty property)
Platform+<>c__DisplayClass45_0.<Cleanup>g__DoCleanup|0 ()
Platform.Cleanup (System.Collections.Generic.List`1[T] viewsToRemove, System.Collections.Generic.List`1[T] renderersToDispose)
Platform.SetPage (Xamarin.Forms.Page newRoot)
Platform.Dispose ()
FormsAppCompatActivity.OnDestroy ()
Activity.n_OnDestroy (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.8(intptr,intptr)

 

This is within the dispose method of what I assume is the telerik control. 

 

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
             x:Class="MobileInterface.Views.QuestionText"
             Shell.PresentationMode="ModalNotAnimated">
    <ContentPage.Content>
        <StackLayout>
            <StackLayout Grid.Row="1" Grid.Column="2" Orientation="Horizontal"
                         VerticalOptions="Start" HorizontalOptions="FillAndExpand"
                         BackgroundColor="{StaticResource Primary}" Padding="10"
                         >
                <Label Text="{Binding LocationTitle}"
                       FontSize="Small"
                       HorizontalTextAlignment="Start" Grid.Column="1"
                       HorizontalOptions="FillAndExpand"
                       TextColor="White"/>
                <Label Text="{Binding Title}"
                       FontSize="Small"
                       HorizontalTextAlignment="End" Grid.Column="2"
                       HorizontalOptions="FillAndExpand"
                       TextColor="White"
                   />
            </StackLayout>
            <Label Text="{Binding QuestionText}"
                   VerticalOptions="Center" 
                   HorizontalOptions="CenterAndExpand"
                   FontSize="Medium"                   
                   Margin="10"/>
            <Entry x:Name="dataEntry"  Text="{Binding Answer, Mode=TwoWay}" 
                   FontSize="{Binding FontSize}" 
                   VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand" 
                   IsVisible="{Binding IsTextType}}"
                   Keyboard="{Binding KeyboardType}"
                   Completed="dataEntry_Completed"
                   Focused="dataEntry_Focused"
                   Margin="10"/>
            <telerikInput:RadDateTimePicker
                x:Name="datePicker"
                Date="{Binding DateAnswer}"
                DefaultHighlightedDate="{Binding DateDefaultHightlight}"
                VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand"
                DisplayStringFormat="d"
                SpinnerFormat="d"
                SelectionChanged="RadDateTimePicker_SelectionChanged"
                IsVisible="{Binding IsDateType}">
                <telerikInput:RadDateTimePicker.SelectorSettings>
                    <telerikInput:PickerPopupSelectorSettings>
                        <telerikInput:PickerPopupSelectorSettings.AcceptButtonStyle>
                            <Style TargetType="Button">
                                <Setter Property="TextColor" Value="White"/>
                            </Style>
                        </telerikInput:PickerPopupSelectorSettings.AcceptButtonStyle>
                        <telerikInput:PickerPopupSelectorSettings.CancelButtonStyle>
                            <Style TargetType="Button">
                                <Setter Property="TextColor" Value="White"/>
                            </Style>
                        </telerikInput:PickerPopupSelectorSettings.CancelButtonStyle>
                    </telerikInput:PickerPopupSelectorSettings>
                </telerikInput:RadDateTimePicker.SelectorSettings>
            </telerikInput:RadDateTimePicker>            
            <Button Margin="0,10,0,0" Text="{Binding ButtonText}"
                        Clicked="Button_Clicked"                        
                        BackgroundColor="{StaticResource Primary}"
                        TextColor="White" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

 

I'm not sure if the IsVisible is what's jamming me up - it's a generic page that either is text based but if the type is a date - I swap out which one is visible.

 

Any input or thoughts are appreciated on this type of error.  It appears that it's been a common one in the Xamarin history.

 

Xamarin Forms:  5.0.0.2125

Telerik.UI.for.Xamarin.Input 2021.3.915.1

(same for the DataControls)

Lance | Manager Technical Support
Telerik team
 updated answer on 15 Oct 2021
1 answer
127 views

Hi, I'm trying to apply theme changes to telerikInput:RadDateTimePicker, place holder & text colour change from ThemeDark.xaml & ThemeLight.xaml

by using

DisplayLabelStyle="{AppThemeBinding Dark={StaticResource TextColorDark},
                                                            Light={StaticResource PrimaryTextColorLight}}"   

and

PlaceholderLabelStyle="{AppThemeBinding Dark={StaticResource TextColorDark},
                                                            Light={StaticResource PrimaryTextColorLight}}"            
                                    SelectionHighlightStyle="{StaticResource selectionHighlightStyle}"

 

but this AppThemeBinding doesn't work, If there is any working solution, please share with me.

Thanks

3 answers
254 views

Hello Telerik Team,

I know there is a command, ClearCommand from the RadPickerBase, which could be used in order to clear out the picker's value. But I need to be able to clear the picker value from inside the selector Popup. Can you help me with this?

This is my datePicker declaration:

<telerik:RadDateTimePicker SelectedDate="{Binding Value}">
  <telerik:RadDateTimePicker.SelectorSettings>
    <telerik:PickerPopupSelectorSettings FooterTemplate="{StaticResource PickerFooterTemplate}" />
  </telerik:RadDateTimePicker.SelectorSettings>
</telerik:RadDateTimePicker>

And this is an attempt to get the Clear command from the datePicker:

 

 

 

 

01.<ControlTemplate x:Key="PickerFooterTemplate">
02.  <StackLayout Orientation="Horizontal"
03.      Spacing="0"
04.      HorizontalOptions="FillAndExpand"
05.      BackgroundColor="{StaticResource SecondaryButtonColor}">
06.    <Button Text="Clear"
07.      TextColor="{StaticResource TextColor}"
08.      BackgroundColor="Transparent"
09.   -->Command="{Binding Source={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadDateTimePicker}, AncestorLevel=1}, Path=ClearCommand}" />
10.    <Button Text="{TemplateBinding AcceptButtonText}"
11.      TextColor="{StaticResource TextColor}"
12.      BackgroundColor="Transparent"
13.      Command="{TemplateBinding AcceptCommand}" />
14.    <Button Text="{TemplateBinding CancelButtonText}"
15.      TextColor="{StaticResource TextColor}"
16.      BackgroundColor="Transparent"
17.      Command="{TemplateBinding CancelCommand}" />
18.  </StackLayout>
19.</ControlTemplate>

Didi
Telerik team
 answered on 20 May 2020
2 answers
43 views
I am setting the start and end date on the control which works mostly but the senario I am having issues with is if I set the end date for 1 month in the future it shows the rest of the year in the picker (which isnt a big deal really) and if i select a date say 2 months in the future it never updates the selected date (which is correct) but it just closes the control without any user feedback. Is there an event that can catch this or some way of setting a warning?
Simon
Top achievements
Rank 1
Veteran
 answered on 06 May 2020
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?