Thank Nasko, but i've other questions about your solution. CustomValidateCommand instance is starting on costructor of the page where i use the telerik grid. It's work fine, but i don't understand who call Execute Method (i asked you because i want set parameter to pass to Execute Method where i can set some object (page properties), that i can investigate when execute method is finished.
For Example, imagine that I have "Boolean" values on the page that establish the validity of the data present on it. Among these values there are some related to the data entered in the grid. for example, we hypothesize that I have a Boolean telling me (going back to the example I mentioned a few days ago) if the city I entered is in the list of "valid" cities. We will then have a property on the grid page called "IsValidCity". How can I return the real value of this property to the page from the Execute method? In the constructor I can of course pass different parameters (for example the list of valid cities). I can then assign a property to the CustomValidateCommad object which is evaluated on the basis of what is passed by the manufacturer and can therefore at that point in the Execute determine if the inserted city is "valid". How can I return this value back? Assuming that there are several lines, I would like to assign "False" to this property if in at least one of the lines there is an invalid city (if I understand correctly the execute I have the focus of the single line I am modifying). The alert can not be used because the page logic requires different behavior. A possible work around would be to use a pickerColumn, but I have another problem, since the list of valid external cities (which is part of another object), I tried to load the data inside an ObservableCollection, but at the moment I do not see the objects contained in the ItemSource on the picker column.
In my gridView i add this column :
<
telerikDataGrid:DataGridPickerColumn
PropertyName
=
"VatP"
CellContentFormat
=
"{}{0:N}"
HeaderText
=
"VAT P"
Width
=
"100"
SizeMode
=
"Fixed"
ItemsSource
=
"VatRate"
>
<
telerikDataGrid:DataGridTextColumn.CellDecorationStyle
>
<
telerikDataGrid:DataGridBorderStyle
BorderThickness
=
"1, 0.5, 0.5, 0.5"
BorderColor
=
"White"
/>
</
telerikDataGrid:DataGridTextColumn.CellDecorationStyle
>
<
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:DataGridPickerColumn
>
Where VatRate is a simple object with decimal property :
public
class
VatRate : ModelObject
{
public
decimal
vat;
public
decimal
VatP {
get
=> vat;
set
{ vat = value; RaisePropertyChanged(
"VatP"
); } }
public
VatRate()
{
}
}
And modelObject is this :
public
class
ModelObject : INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler PropertyChanged;
protected
void
RaisePropertyChanged(
string
name)
{
if
(PropertyChanged !=
null
)
PropertyChanged(
this
,
new
PropertyChangedEventArgs(name));
}
}
And i've in .cs code beheind i create a LoadVatRateMethod :
private void LoadVateRateSource()
{
VatRateListTest = new ObservableCollection<
VatRate
>();
List<
decimal
> vatRateList = new List<
decimal
>() { 10, 5, 15, 22 };
foreach (var item in vatRateList )
{
VatRate myVat = new VatRate();
myVat.VatP = item;
VatRateListTest.Add(myVat);
}
}
where VatRateListTest is an object of VatRate type. When i edit row nothing is displayed in Vat P colum