Hi, i've an complex object that i want to bind on my telerik gridview.
Object to binding in grid is a List<ReceiptRow>..where ReciptRow is this :
public
class
ReceiptRow
{
protected
Int32 rIndex;
private
string
sku;
private
string
description;
private
long
quantity;
private
Totals rowAmmounts;
public
string
Sku {
get
=> sku;
set
=> sku = value; }
public
string
Description {
get
=> description;
set
=> description = value; }
public
long
Quantity {
get
=> quantity;
set
=> quantity = value; }
public
Totals Ammounts {
get
=> rowAmmounts;
set
=> rowAmmounts = value; }
public
Int32 RIndex {
get
=> rIndex; }
}
And where rowsAmmounts is a List<Totals> and totals object is :
public
class
Totals
{
private
decimal
vatAmount;
private
double
vatRate;
private
decimal
netAmount;
private
decimal
grossAmount;
public
decimal
VatAmount {
get
=> vatAmount;
set
=> vatAmount = value; }
public
double
VatRate {
get
=> vatRate;
set
=> vatRate = value; }
public
decimal
NetAmount {
get
=> netAmount;
set
=> netAmount = value; }
public
decimal
GrossAmount {
get
=> grossAmount;
set
=> grossAmount = value; }
}
Which is the syntax for binding VatAmount, VatRate, NetAmount and GrossAmount in my gridview? I'll try with setting PropertyName to : "Totals.Ammounts.VatRate" or "Ammounts.VatRate" or simple VatRate, but i can't see the value on gridView,while i can see Description and Quantity without problem.
Here the xaml of gridView :
<
telerikDataGrid:RadDataGrid
x:Name
=
"gridTest"
Margin
=
"60,0,85,0"
Grid.Row
=
"18"
Grid.Column
=
"0"
Grid.ColumnSpan
=
"4"
Grid.RowSpan
=
"6"
GridLinesVisibility
=
"Both"
UserFilterMode
=
"Disabled"
UserGroupMode
=
"Disabled"
UserSortMode
=
"None"
AutoGenerateColumns
=
"False"
>
<
telerikDataGrid:RadDataGrid.SelectionStyle
>
<
telerikDataGrid:DataGridBorderStyle
BackgroundColor
=
"LightGray"
BorderColor
=
"Black"
BorderThickness
=
"1"
/>
</
telerikDataGrid:RadDataGrid.SelectionStyle
>
<
telerikDataGrid:RadDataGrid.Columns
>
<
telerikDataGrid:DataGridTextColumn
PropertyName
=
"Description"
HeaderText
=
"DESCRIPTION"
Width
=
"280"
SizeMode
=
"Fixed"
>
<
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridColumnHeaderStyle
OptionsButtonTextColor
=
"Transparent"
BackgroundColor
=
"Black"
TextColor
=
"White"
HorizontalTextAlignment
=
"Center"
TextFontSize
=
"10"
BorderColor
=
"#D9D9D9"
BorderThickness
=
"1"
/>
</
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridTextColumn.CellContentStyle
>
<
telerikDataGrid:DataGridTextCellStyle
TextColor
=
"White"
HorizontalTextAlignment
=
"Center"
FontSize
=
"12"
SelectedTextColor
=
"White"
/>
</
telerikDataGrid:DataGridTextColumn.CellContentStyle
>
</
telerikDataGrid:DataGridTextColumn
>
<
telerikDataGrid:DataGridNumericalColumn
PropertyName
=
"Quantity"
HeaderText
=
"QTY"
Width
=
"100"
SizeMode
=
"Fixed"
>
<
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridColumnHeaderStyle
OptionsButtonTextColor
=
"Transparent"
BackgroundColor
=
"Black"
TextColor
=
"White"
HorizontalTextAlignment
=
"Center"
TextFontSize
=
"10"
BorderColor
=
"#D9D9D9"
BorderThickness
=
"1"
/>
</
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridDateColumn.CellContentStyle
>
<
telerikDataGrid:DataGridTextCellStyle
TextColor
=
"White"
FontSize
=
"12"
HorizontalTextAlignment
=
"End"
SelectedTextColor
=
"White"
>
</
telerikDataGrid:DataGridTextCellStyle
>
</
telerikDataGrid:DataGridDateColumn.CellContentStyle
>
</
telerikDataGrid:DataGridNumericalColumn
>
<
telerikDataGrid:DataGridNumericalColumn
PropertyName
=
"Totals.Ammounts.VatRate"
CellContentFormat
=
"{}{0:N}"
HeaderText
=
"VAT"
Width
=
"100"
SizeMode
=
"Fixed"
>
<
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridColumnHeaderStyle
OptionsButtonTextColor
=
"Transparent"
BackgroundColor
=
"Black"
TextColor
=
"White"
HorizontalTextAlignment
=
"Center"
TextFontSize
=
"10"
BorderColor
=
"#D9D9D9"
BorderThickness
=
"1"
/>
</
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridDateColumn.CellContentStyle
>
<
telerikDataGrid:DataGridTextCellStyle
TextColor
=
"White"
FontSize
=
"12"
SelectedTextColor
=
"White"
HorizontalTextAlignment
=
"End"
>
</
telerikDataGrid:DataGridTextCellStyle
>
</
telerikDataGrid:DataGridDateColumn.CellContentStyle
>
</
telerikDataGrid:DataGridNumericalColumn
>
<
telerikDataGrid:DataGridNumericalColumn
PropertyName
=
"Ammounts.GrossAmount"
CellContentFormat
=
"{}{0:N}"
HeaderText
=
"GROSS AMOUNT"
Width
=
"160"
>
<
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridColumnHeaderStyle
OptionsButtonTextColor
=
"Transparent"
BackgroundColor
=
"Black"
TextColor
=
"White"
HorizontalTextAlignment
=
"Center"
TextFontSize
=
"10"
BorderColor
=
"#D9D9D9"
BorderThickness
=
"1"
/>
</
telerikDataGrid:DataGridTextColumn.HeaderStyle
>
<
telerikDataGrid:DataGridDateColumn.CellContentStyle
>
<
telerikDataGrid:DataGridTextCellStyle
TextColor
=
"White"
FontSize
=
"12"
SelectedTextColor
=
"White"
HorizontalTextAlignment
=
"End"
>
</
telerikDataGrid:DataGridTextCellStyle
>
</
telerikDataGrid:DataGridDateColumn.CellContentStyle
>
</
telerikDataGrid:DataGridNumericalColumn
>
</
telerikDataGrid:RadDataGrid.Columns
>
</
telerikDataGrid:RadDataGrid
>
Thanks in advance
Relevant System Information:
- Using .NETStandard 2.0 Library
- Compile using Android 7.1
- Miminum android version 4.0.3
- Target Android version 5.1
- Xamarin Forms 2.4.18342
- Telerik UI for Xamarin R1 2018
I am trying to set the MainContent of the SideDrawer in a similar fashion to the "tagit" application from Telerik. I am using a Listview in the sidedrawer to drive the view switching. Whenever I set the main content I get the following exception:
Type: Java.Lang.IllegalStateException
Message: The specified child already has a parent. You must call removeView() on the child's parent first.
UWP doesn't seem to have the same issue, just android. The weirdest part is that the main content seems to load just fine after the exception is handled. Does anybody else receive this error when setting the main content?
I have a nullable Boolean property in my model.
I also have a custom property converter and custom segment control bound to the nullable Boolean.
In my ContentPage code file I have registered the custom data source provider and the segmented editor.
dataForm.PropertyDataSourceProvider =
new
NullableBoolPropertyDataSourceProvider();
dataForm.RegisterEditor(nameof(Item.BoolToTest), EditorType.SegmentedEditor);
Yet when I run the code and click the buttons in the segmented editor, it does not call the Boolean property setter.
Other properties in the model work fine in that their setter gets called when they are edited on the DataForm.
How do I get the buttons in the segmented editor to fire / call the Boolean setter?
Below is the code.
Public
class
TestModel
{
[DisplayOptions(Header =
"Yes / No / Unknown ?"
)]
[Converter(
typeof
(NullableBoolPropertyConverter))]
[DataSourceKey(
"NullableBoolSegementedControl"
)]
public
bool
? BoolToTest
{
get
{
return
this
.boolToTest; }
set
{
if
(value !=
this
.boolToTest)
{
this
.boolToTest = value;
OnPropertyChanged();
}
}
}
}
public
class
NullableBoolPropertyDataSourceProvider : PropertyDataSourceProvider
{
public
override
IList GetSourceForKey(
object
key)
{
switch
(key.ToString())
{
case
"NullableBoolSegementedControl"
:
return
new
List<
string
>
{
""
,
"NO"
,
"YES"
};
default
:
return
base
.GetSourceForKey(key);
}
}
}
public
class
NullableBoolPropertyConverter : IPropertyConverter
{
public
object
Convert(
object
value)
{
if
(value
is
bool
)
switch
((
bool
?)value)
{
case
true
:
return
"YES"
;
case
false
:
return
"NO"
;
default
:
return
""
;
}
if
(value ==
null
)
return
""
;
return
value;
}
public
object
ConvertBack(
object
value)
{
if
(value
is
string
)
{
switch
((
string
)value)
{
case
"YES"
:
return
true
as
bool
?;
case
"NO"
:
return
false
as
bool
?;
default
:
return
null
as
bool
?;
}
}
switch
((
bool
?)value)
{
case
true
:
return
"YES"
;
case
false
:
return
"NO"
;
default
:
return
""
;
}
}
}
On iOS I can create a calendar delegate that returns a custom cell.
How do I do this on Android? I can't find the equivalent types.
hi
How can i change the caret color (where my cursor or typing appears)
I want to be able to detect when the page changes so that I can call a particular method when a certain page is shown.
The documentation describes how to do this in the code-behind but I am using a mvvm framework and I cannot get this part to work from my view model.
Does anyone know how I can detect the slide event from my view model?
Hi,
The installer doesn't see VS2017 preview. How can I install the product there?
Tks.
Hi,
On RadListView there is no ItemHold event as in the description on this page.
https://docs.telerik.com/devtools/xamarin/controls/listview/features/listview-features-events
Thank you.