I'm binding a RadDataGrid to a DataTable and it works well, except:
So, basically, I don't see a way to do something after the binding is complete and the columns have been autogenerated.
Hello,
I have a problem regarding the Calendar DayView on UWP. The problem does not occur for my app on iOS or Android. To load our appointments asynchronous for specific Dates I use the Event SelectionChanged with the prism:EventToCommandBehavior. Everytime the user changes the current day in the dayview new appointments should by loaded by that command and displayed afterwards. Sadly this only works for iOS and Android. On UWP the command is never executed since the event is not triggered. I am using the Telerik.UI.for.Xamarin Nuget-Package Version 2022.1.11 and Prism.Unity.Forms 8.1.97.
Below you can find test code for the problem. In this example the same appointments are created when changing the current day in the dayview.
View:
<pages:vContentPage
x:Class="v.App.Views.AboutPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:v.App.Styling.Pages;assembly=v.App"
xmlns:prism="http://prismlibrary.com"
xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
Title="About"
prism:ViewModelLocator.AutowireViewModel="True"
BackgroundColor="{DynamicResource ColorBackgroundPrimary}">
<telerikInput:RadCalendar x:Name="calendar"
ViewMode="Day"
AppointmentsSource="{Binding Appointments}">
<telerikInput:RadCalendar.DayViewSettings>
<telerikInput:DayViewSettings
DayStartTime="6:00:00"
DayEndTime="18:00:00"
TimelineInterval="1:00"
IsCurrentTimeIndicatorVisible="True"/>
</telerikInput:RadCalendar.DayViewSettings>
<telerikInput:RadCalendar.Behaviors>
<prism:EventToCommandBehavior
Command="{Binding DaySelectionChangedCommand}"
EventArgsConverter="{StaticResource TelerikValueChangedEventArgsConverter}"
EventName="SelectionChanged" />
</telerikInput:RadCalendar.Behaviors>
</telerikInput:RadCalendar>
</pages:vContentPage>
Corresponding ViewModel:
using Prism.Commands;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using Telerik.XamarinForms.Input;
using v.App.Helper.Settings;
using v.App.ViewModels.Base;
namespace v.App.ViewModels
{
public class AboutPageViewModel : BaseViewModel
{
#region Constructor
public AboutPageViewModel()
{
}
private ObservableCollection<Appointment> _appointments = new ObservableCollection<Appointment>();
public ObservableCollection<Appointment> Appointments
{
get { return _appointments; }
set { _appointments = value; }
}
private DelegateCommand<object> _daySelectionChangedCommand;
public DelegateCommand<object> DaySelectionChangedCommand
{
get { return _daySelectionChangedCommand ?? (_daySelectionChangedCommand = new DelegateCommand<object>(async (parameter) => await LoadAppointments(parameter))); }
}
private async Task LoadAppointments(object parameter)
{
if (parameter == null)
return;
await Task.Delay(1);
var today = DateTime.Today;
Appointments.Add(new Appointment
{
Title = "Meeting with Tom",
Detail = "Sea Garden",
StartDate = today.AddHours(7),
EndDate = today.AddHours(4),
Color = Color.Tomato
});
Appointments.Add(new Appointment
{
Title = "Lunch with Sara",
Detail = "Restaurant",
StartDate = today.AddHours(12).AddMinutes(30),
EndDate = today.AddHours(14),
Color = Color.DarkTurquoise
});
Appointments.Add(new Appointment
{
Title = "Elle Birthday",
StartDate = today,
EndDate = today.AddHours(11),
Color = Color.Orange,
IsAllDay = true
});
Appointments.Add(new Appointment
{
Title = "Football Game",
StartDate = today.AddDays(2).AddHours(15),
EndDate = today.AddDays(2).AddHours(17),
Color = Color.Green
});
}
#endregion Constructor
#region Properties
public override bool ShowOnlineOfflineTemplate { get => false;}
#endregion Properties
}
}
Hello,
I have an issue regarding the Load on Demand behavior of the Telerik ListView for Xamarin. First i will explain how i defined my ListView and how it should work. The ListView was defined as follows:
<telerikDataControls:RadListView
ItemsSource="{Binding MyTickets}"
SelectedItem="{Binding SelectedTicket, Mode=TwoWay}"
SelectionMode="Single"
HeaderTemplate="{StaticResource HeaderTemplate}"
FooterTemplate="{StaticResource FooterTemplate}"
Grid.Row="3"
IsLoadOnDemandEnabled="True"
LoadOnDemandMode="Automatic">
<telerikDataControls:RadListView.Behaviors>
<prism:EventToCommandBehavior
Command="{Binding ItemTappedCommand}"
EventName="ItemTapped" />
</telerikDataControls:RadListView.Behaviors>
<telerikDataControls:RadListView.Commands>
<telerikListViewCommands:ListViewUserCommand
Id="LoadOnDemand"
Command="{Binding LoadItemsCommand}" />
</telerikDataControls:RadListView.Commands>
<telerikDataControls:RadListView.ItemTemplate>
...
</telerikDataControls:RadListView.ItemTemplate>
</telerikDataControls:RadListView>
I have left out the ItemTemplate since it is not relevant for the problem.
As you can see we use the LoadOnDemandMode Automatic for this ListView to load the Data. When the LoadOnDemand event is triggered we load the data with the LoadItemsCommand. The LoadItemsCommand loads 10 elements at a time which functions as lazy loading. The Telerik ListView default value for the MaxRemainingItems is 10. The problem now is that the LoadItemsCommand is triggered twice when opening the page since only 10 elements are loaded each time. We would like to only load 10 elements each time and if the user scrolls down we want to load the next 10 elements.
To solve this problem we tried creating a custom renderer for the ListView and change the value of MaxRemainingItems. We were able to change the value of MaxRemainingItems in the custom renderer but after doing so our LoadItemsCommand was never triggered when the user was scrolling through the ListView. The custom renderer and Listview were tested for Android. I hope you can help us resolve this issue.
We are using Telerik.UI.for.Xamarin Nuget-Package Version 2022.1.1.
Thank you in advance.
<telerikPrimitives:RadPopup.Popup>
<telerikPrimitives:RadPopup x:Name="popuptwo" IsModal="True" Placement="Center">
<telerikPrimitives:RadBorder WidthRequest="250" HorizontalOptions="Center" VerticalOptions="Center" CornerRadius="8" BackgroundColor="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="42"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.ColumnSpan="2">
<telerikInput:RadButton ContentLayout="Left,4" x:Name="images" HorizontalOptions="Start"
BorderColor="#c9c9c9" BackgroundColor="#4295F4" TextColor="White" BorderWidth="1" CornerRadius="8" WidthRequest="400" VerticalOptions="Center"/>
</Grid>
</Grid>
</telerikPrimitives:RadBorder>
</telerikPrimitives:RadPopup>
</telerikPrimitives:RadPopup.Popup>
hello,
I want to change the display field to Chinese. How can I get the key of the display field of calendar? Now I can only get calendar_ AllDayAreaText
<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--后端
InitializeComponent();<telerikPrimitives:RadPopup.Popup>
<telerikPrimitives:RadPopup x:Name="popuptwo" IsModal="True" Placement="Center">
<telerikPrimitives:RadBorder WidthRequest="250" Margin="0,0,0,20" HeightRequest="42" HorizontalOptions="Center" VerticalOptions="Center" CornerRadius="8" BackgroundColor="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="42"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.ColumnSpan="2">
<telerikInput:RadButton ContentLayout="Left,4" x:Name="images" HorizontalOptions="Start"
BorderColor="#c9c9c9" BackgroundColor="#4295F4" TextColor="White" BorderWidth="1" CornerRadius="8" WidthRequest="400" VerticalOptions="Center"/>
</Grid>
</Grid>
</telerikPrimitives:RadBorder>
</telerikPrimitives:RadPopup>
</telerikPrimitives:RadPopup.Popup>
popuptwo.IsOpen = true;
images.ImageSource = success;
images.Text = "成功";
Device.StartTimer(TimeSpan.FromMilliseconds(2000),
() =>
{
popuptwo.IsOpen = false;
return false;
});
Can this English word be changed into Chinese
<Grid Grid.Row="0" Grid.Column="1">
<telerikInput:RadDateTimePicker SpinnerFormat="yyyy-MM-dd HH:mm:ss" x:Name="StarDateTime" BorderColor="#c9c9c9" BorderThickness="1"
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" BorderColor="#c9c9c9" BorderThickness="1"
PlaceholderTemplate="{StaticResource placeholderTemplateEnd}"
DisplayTemplate="{StaticResource displayTemplate}">
<telerikInput:RadDateTimePicker.SelectorSettings>
<telerikInput:PickerPopupSelectorSettings HeaderTemplate="{StaticResource headerTemplate}"
FooterTemplate="{StaticResource footerTemplate}" x:Name="names"/>
</telerikInput:RadDateTimePicker.SelectorSettings>
</telerikInput:RadDateTimePicker>
</Grid>
<ControlTemplate x:Key="placeholderTemplateStar">