Documentation Fixes
This commit is contained in:
Родитель
5b5a251abc
Коммит
9a2d3bbe97
|
@ -22,6 +22,12 @@ The RadListView component exposes the following events:
|
||||||
* The sender argument which is of type object, but can be cast to the __RadListView__ type.
|
* The sender argument which is of type object, but can be cast to the __RadListView__ type.
|
||||||
* An __ItemHoldEventArgs__ object which has a reference to the held item through its **Item** property.
|
* An __ItemHoldEventArgs__ object which has a reference to the held item through its **Item** property.
|
||||||
|
|
||||||
|
* __RefreshRequested__ - occurs when the pull-to-refresh gesture is triggered. The __RefreshRequested__ event handler receives two parameters:
|
||||||
|
* The sender argument which is of type object, but can be cast to the __RadListView__ type.
|
||||||
|
* A __PullToRefreshRequestedEventArgs__ object which provides Cancel property used to cancel the pull-to-refresh operation.
|
||||||
|
|
||||||
|
>tip For more details on the RefreshRequested event usage go to [Pull to Refresh]({%slug listview-features-pull-to-refresh%}) topic.
|
||||||
|
|
||||||
### Selection events
|
### Selection events
|
||||||
|
|
||||||
* __SelectionChanged__ - occurs when the SelectionItems collection is updated. The __SelectionChanged__ event handler receives two parameters:
|
* __SelectionChanged__ - occurs when the SelectionItems collection is updated. The __SelectionChanged__ event handler receives two parameters:
|
||||||
|
@ -46,14 +52,14 @@ The RadListView component exposes the following events:
|
||||||
* The sender argument which is of type object, but can be cast to the __RadListView__ type.
|
* The sender argument which is of type object, but can be cast to the __RadListView__ type.
|
||||||
* A __ReorderEndedEventArgs__ object which has a reference to the item that was reordered through its **Item** property;
|
* A __ReorderEndedEventArgs__ object which has a reference to the item that was reordered through its **Item** property;
|
||||||
|
|
||||||
>You could also check the events related to the cell swiping feature [here]({%slug listview-features-cell-swipe %}).
|
### Swipe Events
|
||||||
|
|
||||||
|
RadListView exposes a few useful events related to the item swiping feature, namely __ItemSwipeStarting__, __ItemSwiping__ and __ItemSwipeCompleted__. For detailed information on the swiping events usage go to [Cell Swipe]({%slug listview-features-cell-swipe %}) topic.
|
||||||
|
|
||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
[Selection]({%slug listview-features-selection%})
|
- [Selection]({%slug listview-features-selection%})
|
||||||
|
- [Grouping]({%slug listview-features-grouping%})
|
||||||
[Grouping]({%slug listview-features-grouping%})
|
- [Reordering]({%slug listview-features-reorder-items%})
|
||||||
|
- [Pull to Refresh]({%slug listview-features-pull-to-refresh%})
|
||||||
[Reordering]({%slug listview-features-reorder-items%})
|
- [Cell Swipe]({%slug listview-features-cell-swipe %})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,12 @@ public class ViewModel
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Set thus defined ViewModel as a BindingContext of the page:
|
||||||
|
|
||||||
|
```C#
|
||||||
|
this.BindingContext = new ViewModel();
|
||||||
|
```
|
||||||
|
|
||||||
also you will need to add the following namespace:
|
also you will need to add the following namespace:
|
||||||
|
|
||||||
```XAML
|
```XAML
|
||||||
|
|
|
@ -17,6 +17,7 @@ Its purpose is to specify a property of the source object to serve as the visual
|
||||||
## DisplayStringFormat
|
## DisplayStringFormat
|
||||||
|
|
||||||
You can choose what text to display when an item from the spinner was picked through the Picker DisplayStringFormat property.
|
You can choose what text to display when an item from the spinner was picked through the Picker DisplayStringFormat property.
|
||||||
|
|
||||||
## SelectedValue
|
## SelectedValue
|
||||||
|
|
||||||
The SelectedValue property is used when you have linked your RadTemplatedPicker to a data source, and you want to return a value of type object other than the one which is displayed.
|
The SelectedValue property is used when you have linked your RadTemplatedPicker to a data source, and you want to return a value of type object other than the one which is displayed.
|
||||||
|
@ -35,11 +36,11 @@ and for the HeaderTemplate:
|
||||||
|
|
||||||
<snippet id='templatedpicker-keyfeatures-headertemplate' />
|
<snippet id='templatedpicker-keyfeatures-headertemplate' />
|
||||||
|
|
||||||
add the following Business model for the first spinner:
|
add the following data item for the first spinner:
|
||||||
|
|
||||||
<snippet id='templatedpicker-country-businessmodel' />
|
<snippet id='templatedpicker-country-businessmodel' />
|
||||||
|
|
||||||
add the following Business model for the second spinner:
|
add the following data item for the second spinner:
|
||||||
|
|
||||||
<snippet id='templatedpicker-city-businessmodel' />
|
<snippet id='templatedpicker-city-businessmodel' />
|
||||||
|
|
||||||
|
@ -47,6 +48,12 @@ here is a sample definition of the ViewModel:
|
||||||
|
|
||||||
<snippet id='templatedpicker-viewmodel' />
|
<snippet id='templatedpicker-viewmodel' />
|
||||||
|
|
||||||
|
Set thus defined ViewModel as a BindingContext of the page:
|
||||||
|
|
||||||
|
```C#
|
||||||
|
this.BindingContext = new ViewModel();
|
||||||
|
```
|
||||||
|
|
||||||
In addition to this, you need to add the following namespace:
|
In addition to this, you need to add the following namespace:
|
||||||
|
|
||||||
```XAML
|
```XAML
|
||||||
|
|
|
@ -106,6 +106,12 @@ here is a sample definition of the ViewModel:
|
||||||
|
|
||||||
<snippet id='templatedpicker-viewmodel' />
|
<snippet id='templatedpicker-viewmodel' />
|
||||||
|
|
||||||
|
Set thus defined ViewModel as a BindingContext of the page:
|
||||||
|
|
||||||
|
```C#
|
||||||
|
this.BindingContext = new ViewModel();
|
||||||
|
```
|
||||||
|
|
||||||
In addition to this, you need to add the following namespace:
|
In addition to this, you need to add the following namespace:
|
||||||
|
|
||||||
```XAML
|
```XAML
|
||||||
|
|
|
@ -50,6 +50,12 @@ here is a sample definition of the ViewModel:
|
||||||
|
|
||||||
<snippet id='templatedpicker-viewmodel' />
|
<snippet id='templatedpicker-viewmodel' />
|
||||||
|
|
||||||
|
Set thus defined ViewModel as a BindingContext of the page:
|
||||||
|
|
||||||
|
```C#
|
||||||
|
this.BindingContext = new ViewModel();
|
||||||
|
```
|
||||||
|
|
||||||
In addition to this, you need to add the following namespace:
|
In addition to this, you need to add the following namespace:
|
||||||
|
|
||||||
```XAML
|
```XAML
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
---
|
||||||
|
title: How to implement keyboard support in RadMaskedInput
|
||||||
|
description: How to set the virtual keyboard to the Xamarin MaskedInput control
|
||||||
|
type: how-to
|
||||||
|
page_title: Set numeric keyboard to MaskedInput through renderers on Android and iOS
|
||||||
|
slug: maskedinput-set-virtual-keyboard
|
||||||
|
position:
|
||||||
|
tags: maskedinput, keyboard
|
||||||
|
ticketid: 1497050
|
||||||
|
res_type: kb
|
||||||
|
---
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Product Version</td>
|
||||||
|
<td>R3 2020</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Product</td>
|
||||||
|
<td>MaskedInput for Xamarin.Forms</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Currently RadMaskedInput does not provide Keyboard property, so users can define the virtual keyboard type. Still, this can be implemented through custom renderers on Android and iOS. The sample renderers below show how to define numeric virtual keyboard for the MaskedInput control.
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
* Here is the solution on Android (replace "XamarinSampleApp" with the namespace used in your app):
|
||||||
|
|
||||||
|
```C#
|
||||||
|
using Android.Content;
|
||||||
|
using Telerik.XamarinForms.Input;
|
||||||
|
using Telerik.XamarinForms.InputRenderer.Android;
|
||||||
|
using Xamarin.Forms.Platform.Android;
|
||||||
|
using XamarinSampleApp.Droid;
|
||||||
|
|
||||||
|
[assembly: Xamarin.Forms.ExportRenderer(typeof(MaskedInputElement), typeof(MyCustomMaskRenderer))]
|
||||||
|
namespace XamarinSampleApp.Droid
|
||||||
|
{
|
||||||
|
public class MyCustomMaskRenderer : MaskedInputRenderer
|
||||||
|
{
|
||||||
|
public MyCustomMaskRenderer(Context context) : base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<MaskedInputElement> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
var inputType = this.Control.InputType;
|
||||||
|
this.Control.SetRawInputType(Android.Text.InputTypes.ClassNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* And the custom renderer on iOS (replace "XamarinSampleApp" with the namespace used in your app):
|
||||||
|
|
||||||
|
```C#
|
||||||
|
using UIKit;
|
||||||
|
using Telerik.XamarinForms.Input;
|
||||||
|
using Telerik.XamarinForms.InputRenderer.iOS;
|
||||||
|
using Xamarin.Forms.Platform.iOS;
|
||||||
|
using XamarinSampleApp.iOS;
|
||||||
|
|
||||||
|
[assembly: Xamarin.Forms.ExportRenderer(typeof(MaskedInputElement), typeof(MyCustomMaskRenderer))]
|
||||||
|
namespace XamarinSampleApp.iOS
|
||||||
|
{
|
||||||
|
public class MyCustomMaskRenderer : MaskedInputRenderer
|
||||||
|
{
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<MaskedInputElement> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
this.Control.KeyboardType = UIKeyboardType.DecimalPad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
|
@ -73,21 +73,31 @@ Check below the appearance of the filtering component within the RadDataGrid aft
|
||||||
|
|
||||||
### Localization using ResourceManager
|
### Localization using ResourceManager
|
||||||
|
|
||||||
The second option for applying localization is through setting a custom **ResourceManager**:
|
The second option for applying localization is through setting a custom **ResourceManager**.
|
||||||
|
|
||||||
<snippet id='datagrid-setting-the-custom-resource-manager-csharp'/>
|
|
||||||
|
|
||||||
In the same way as the built-in mechanism for localizing .NET applications uses [RESX files](https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/ekyft91f(v=vs.90)) and the classes in the **System.Resources** and **System.Globalization** namespaces, Telerik Xamarin controls rely on similar setup to achieve the functionality.
|
In the same way as the built-in mechanism for localizing .NET applications uses [RESX files](https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/ekyft91f(v=vs.90)) and the classes in the **System.Resources** and **System.Globalization** namespaces, Telerik Xamarin controls rely on similar setup to achieve the functionality.
|
||||||
|
|
||||||
You should add different resource files according to the different languages/cultures which you would like to use. Next image shows an example of a custom resource file used for German:
|
You should add different resource (.RESX) files according to the different languages/cultures which you would like to use. Imagine that you want to translate your control, RadDataGrid for example, into English and German. You will have to add two new resource files to your Xamarin.Forms project with **Embedded resource** Build action:
|
||||||
|
|
||||||
|
* **DataGridResource.resx** - this resource file will store the English(default) resources for the DataGrid control.
|
||||||
|
|
||||||
|
* **DataGridResource.de.resx** - this resource file will store the German resources for the DataGrid control. It will be automatically used when the language of the target device is set to German.
|
||||||
|
|
||||||
|
Next image shows an example of a custom resource file used for German:
|
||||||
|
|
||||||
![custom resource file](images/datagrid_resourcesfile.png)
|
![custom resource file](images/datagrid_resourcesfile.png)
|
||||||
|
|
||||||
The resource file ends with "de.resx" and is automatically used when the language of the target device is set to German.
|
In order to apply the localization from the **DataGridResource** resource files, you would need to set the **ResourceManager** property of the TelerikLocalizationManager.Manager to the DataGridResource.ResourceManager:
|
||||||
|
|
||||||
Check below the appearance of the filtering control when the localization is applied:
|
<snippet id='datagrid-setting-the-custom-resource-manager-csharp' />
|
||||||
|
|
||||||
|
>important You should set the custom manager before the InitializeComponent() method is invoked otherwise the default values will be applied to the RadDataGrid.
|
||||||
|
|
||||||
|
Check the appearance of the filtering control when the localization is applied:
|
||||||
|
|
||||||
#### Figure 3: Custom Resource File for German language
|
#### Figure 3: Custom Resource File for German language
|
||||||
![custom resource manager](images/datagrid_resourcemanager.png)
|
![custom resource manager](images/datagrid_resourcemanager.png)
|
||||||
|
|
||||||
>important You can check a working example in the **DataGrid/Localization/CustomResourceManager** folder within the **SDK Samples Browser**.
|
>important You can check working localization examples in the **DataGrid/Localization** folder within the [SDK Browser application]({%slug developer-focused-examples%}#sdk-browser-application).
|
||||||
|
>
|
||||||
|
>You can directly explore the code in the [SDKBrowser Examples repository on GitHub](https://github.com/telerik/xamarin-forms-sdk/tree/master/XamarinSDK/SDKBrowser/SDKBrowser/Examples/DataGridControl/LocalizationCategory).
|
||||||
|
|
Загрузка…
Ссылка в новой задаче