This commit is contained in:
PROGRESS\kerpecheva 2018-11-27 15:07:49 +02:00
Родитель 246d79e2e7
Коммит 787edaabe9
5 изменённых файлов: 213 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,41 @@
---
title: Event raised when selected tokens are removed through clear button
description: Which event is fired when the user presses the X on the AutoCompleteView control
type: how-to
page_title: How to get item / token removed from AutoCompleteView by clicking cross
slug: autocompleteview-remove-token-event
tags: autocompleteview, autocomplete, tokens, clear, event
ticketid: 1362486, 1176309
res_type: kb
---
## Environment
<table>
<tr>
<td>Product Version</td>
<td>2018.3.1109.1</td>
</tr>
<tr>
<td>Product</td>
<td>AutoCompleteView for Xamarin</td>
</tr>
</table>
## Description
This article shows which event you could handle when the end user removes any of the selected in RadAutoCompleteView tokens by tapping on the clear button.
## Solution
You would need to subscribe to the CollectionChanged event of the Tokens collection of the AutoCompleteView control. Here is a quick snippet which demonstrates the approach:
autoCompleteView.Tokens.CollectionChanged += TokensCollectionChanged;
and the TokensCollectionChanged event handler:
private void TokensCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
var removedTokens = e.OldItems;
}
Through the *NotifyCollectionChangedEventArgs* you could find the added/removed items from the collection.

Просмотреть файл

@ -0,0 +1,61 @@
---
title: Hide Title in RadCalendar
description: How to remove the view title from Calendar control
type: how-to
page_title: Remove the day and month title from Calendar view
slug: calendar-hide-title
tags: calendar, title, renderer
ticketid: 1362025
res_type: kb
---
## Environment
<table>
<tr>
<td>Product Version</td>
<td>2018.3.1109</td>
</tr>
<tr>
<td>Product</td>
<td>Calendar for Xamarin Cross-Platform</td>
</tr>
</table>
## Description
RadCalendar for Xamarin.Forms does not provide direct API for removing the Title (e.g: November 2018) of the current view, still you could implement it natively for Android and iOS through custom renderers. The code below shows sample implementations for hiding the Calendar Title:
## Solution
* For Android you would need to set ShowTitle property:
```C#
public class CustomCalendarRenderer : CalendarRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
{
base.OnElementChanged(e);
if (this.Control != null)
{
this.Control.ShowTitle = false;
}
}
}
```
* For iOS you would need to get TKCalendarMonthPresenter and set its TitleHidden property:
```C#
public class CustomCalendarRenderer : Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
{
base.OnElementChanged(e);
if (Control.Presenter is TKCalendarMonthPresenter)
{
(Control.Presenter as TKCalendarMonthPresenter).TitleHidden = true;
}
}
}
```

Просмотреть файл

@ -0,0 +1,111 @@
---
title: Position DataForm editors on new lines on iOS
description: DataForm Text/Label/Header section on iOS does not wrap like Android
type: how-to
page_title: How to have the titles above the input fields on iOS so it looks the same as on Android in DataForm
slug: dataform-wrap-titles-editors
tags:
ticketid: 1154373, 1117268, 1113888
res_type: kb
---
## Environment
<table>
<tr>
<td>Product Version</td>
<td>2018.3.1109</td>
</tr>
<tr>
<td>Product</td>
<td>DataForm for Xamarin Cross-Platform</td>
</tr>
</table>
## Description
Currently DataForm is designed to follow the native look &mp; feel of the platform, so the editors containing a header and an input field are arranged differently on iOS and Android. You could rearrange the components in each editor in DataForm on iOS through a custom renderer.
You would need to create a class that inherits from DataFormRenderer and override its *UpdateEditor* method - in it you could get a reference to each of the editors you're using ( you could check the available editors and their counterparts on iOS [here]({%slug dataform-editors%}#editor-types) and update their layout per your needs.
In addition, you would need to override the method for setting the height of the editors that is defined through a DataFormDelegate.
## Solution
Let's have the following sample DataForm definition:
<telerikInput:RadDataForm x:Name="dataForm">
<telerikInput:RadDataForm.Source>
<local:SourceItem />
</telerikInput:RadDataForm.Source>
</telerikInput:RadDataForm>
and a sample SourceItem:
public class SourceItem
{
[DisplayOptions(Header = "Name")]
public string Name { get; set; }
[DisplayOptions(Header = "Age")]
public int Age { get; set; }
[DisplayOptions(Header = "Weight (kg)")]
public double Weight { get; set; }
[DisplayOptions(Header = "Height (cm)")]
public int Height { get; set; }
}
with the editors defined like this:
dataForm.RegisterEditor(nameof(SourceItem.Age), EditorType.IntegerEditor);
dataForm.RegisterEditor(nameof(SourceItem.Name), EditorType.TextEditor);
dataForm.RegisterEditor(nameof(SourceItem.Weight), EditorType.DecimalEditor);
dataForm.RegisterEditor(nameof(SourceItem.Height), EditorType.IntegerEditor);
The snippet below shows how you would need to implement the CustomDataFormRenderer and UpdateEditor method:
public class CustomDataFormRenderer : DataFormRenderer
{
protected override TKDataFormDelegate GetDataFormDelegate(TKDataForm form)
{
return new IOSDataFormDelegate(this);
}
public class IOSDataFormDelegate : DataFormDelegate
{
public IOSDataFormDelegate(DataFormRenderer renderer) : base(renderer)
{
}
public override nfloat HeightForEditor(TKDataForm dataForm, uint groupIndex, uint editorIndex)
{
return 70;
}
}
protected override void UpdateEditor(TKDataFormEditor editor, IEntityProperty property)
{
if (editor is TKDataFormTextFieldEditor)
{
var editorDef = editor.GridLayout.Definitions[4];
editorDef.Row = 1;
editorDef.Column = 1;
editorDef.ColumnSpan = 3;
var editorLabelDef = editor.GridLayout.Definitions[1];
editorLabelDef.Row = 0;
editorLabelDef.Column = 1;
var feedbackDef = editor.GridLayout.Definitions[3];
feedbackDef.Row = 2;
}
base.UpdateEditor(editor, property);
}
}
Here is the result:
#### Before:
![](images/dataform-wrap-titles-editors_1.png)
#### After:
![](images/dataform-wrap-titles-editors_2.png)

Двоичные данные
knowledge-base/images/dataform-wrap-titles-editors_1.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 11 KiB

Двоичные данные
knowledge-base/images/dataform-wrap-titles-editors_2.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 11 KiB