This question is locked. New answers and comments are not allowed.
I have implemented a new class for the above mentioned command (http://www.telerik.com/help/windows-8-xaml/datagrid-commands-columnheadertapcommand.html).
My UI page has a RadGrid which is has the command bound to the new class via XAML and all is working as I need it except for one thing:
I need to notify my UI page from the command class I implemented that I have completed the operation I am doing in the code
How do I notify the UI page?
Here is the radgrid xaml:
---------------------------------
<telerikGrid:RadDataGrid x:Name="radEP">
<telerikGrid:RadDataGrid.Commands>
<local:CustomColumnHeaderTapCommand />
</telerikGrid:RadDataGrid.Commands>
<telerikGrid:RadDataGrid.Resources>
<Style TargetType="gridPrimitives:DataGridCurrencyControl">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBackgroundControl">
<Setter Property="Background" Value="Yellow" />
</Style>
<Style TargetType="gridPrimitives:DataGridHoverControl">
<Setter Property="Background" Value="#FFFFFF84" />
<Setter Property="Opacity" Value="0.5" />
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBorderControl">
<Setter Property="BorderBrush" Value="Red" />
</Style>
</telerikGrid:RadDataGrid.Resources>
<telerikGrid:RadDataGrid.Columns>
...
// all columns here
...
</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
The command class:
----------------------------
/// <summary>
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/// Custom command for header tap to allow us to select a column
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/// </summary>
public class CustomColumnHeaderTapCommand : DataGridCommand
{
private string _currentItem = string.Empty;
public CustomColumnHeaderTapCommand ( )
{
this.Id = CommandId.ColumnHeaderTap;
}
public override bool CanExecute ( object parameter )
{
// set colname from parameter
Telerik.UI.Xaml.Controls.Grid.Commands.ColumnHeaderTapContext context = parameter as ColumnHeaderTapContext;
string gcSelectName = context.Column.Name;
// clear all cells of selections
this.Owner.DeselectAll();
// get read only DataView data and count
IReadOnlyList<object> roList = this.Owner.GetDataView().Items;
int roCount = roList.Count;
// displays the value for every column for the current row
for (int row = 0; row < roCount; row++)
{
this.Owner.SelectCell(new DataGridCellInfo((this.Owner.ItemsSource as List<T_EPro>)[row], this.Owner.Columns[gcSelectName]));
}
// I WANT TO NOTIFY THE XAML PAGE HERE
return true;
}
public override void Execute ( object parameter )
{
var context = parameter as ColumnHeaderTapContext;
}
}
My UI page has a RadGrid which is has the command bound to the new class via XAML and all is working as I need it except for one thing:
I need to notify my UI page from the command class I implemented that I have completed the operation I am doing in the code
How do I notify the UI page?
Here is the radgrid xaml:
---------------------------------
<telerikGrid:RadDataGrid x:Name="radEP">
<telerikGrid:RadDataGrid.Commands>
<local:CustomColumnHeaderTapCommand />
</telerikGrid:RadDataGrid.Commands>
<telerikGrid:RadDataGrid.Resources>
<Style TargetType="gridPrimitives:DataGridCurrencyControl">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBackgroundControl">
<Setter Property="Background" Value="Yellow" />
</Style>
<Style TargetType="gridPrimitives:DataGridHoverControl">
<Setter Property="Background" Value="#FFFFFF84" />
<Setter Property="Opacity" Value="0.5" />
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBorderControl">
<Setter Property="BorderBrush" Value="Red" />
</Style>
</telerikGrid:RadDataGrid.Resources>
<telerikGrid:RadDataGrid.Columns>
...
// all columns here
...
</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
The command class:
----------------------------
/// <summary>
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/// Custom command for header tap to allow us to select a column
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/// </summary>
public class CustomColumnHeaderTapCommand : DataGridCommand
{
private string _currentItem = string.Empty;
public CustomColumnHeaderTapCommand ( )
{
this.Id = CommandId.ColumnHeaderTap;
}
public override bool CanExecute ( object parameter )
{
// set colname from parameter
Telerik.UI.Xaml.Controls.Grid.Commands.ColumnHeaderTapContext context = parameter as ColumnHeaderTapContext;
string gcSelectName = context.Column.Name;
// clear all cells of selections
this.Owner.DeselectAll();
// get read only DataView data and count
IReadOnlyList<object> roList = this.Owner.GetDataView().Items;
int roCount = roList.Count;
// displays the value for every column for the current row
for (int row = 0; row < roCount; row++)
{
this.Owner.SelectCell(new DataGridCellInfo((this.Owner.ItemsSource as List<T_EPro>)[row], this.Owner.Columns[gcSelectName]));
}
// I WANT TO NOTIFY THE XAML PAGE HERE
return true;
}
public override void Execute ( object parameter )
{
var context = parameter as ColumnHeaderTapContext;
}
}