private void radDocking1_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e) { var somePane = e.OriginalSource as RadPane; if (somePane == radPane1 && !somePane.IsFloating && radPane1.PaneGroup == radPane2.PaneGroup) HandleDockEvent(); }
DataTable table = new DataTable("Data Table");
DataColumn column;
DataRow row;
column = new DataColumn();
column.DataType = typeof(DateTime);
column.ColumnName = "Time";
column.ReadOnly = true;
column.Unique = true;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = typeof(double);
column.ColumnName = "A";
column.ReadOnly = true;
column.Unique = false;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = typeof(double);
column.ColumnName = "B";
column.ReadOnly = true;
column.Unique = false;
table.Columns.Add(column);
// Create three new DataRow objects and add
// them to the DataTable
for (int i = 0; i <= 20; i++)
{
row = table.NewRow();
row["Time"] = DateTime.Now.AddSeconds(i);
row["A"] = random.NextDouble() * 100;
row["B"] = random.NextDouble() * 50;
table.Rows.Add(row);
}
gridView.ItemsSource = table;
public static class Statistics
{
public static double StdDev<
TSource
>(DataTable source, Func<
TSource
, double> selector)
{
int itemCount = source.Rows.Count();
if (itemCount > 1)
{
IEnumerable<
double
> values = from i in source select Convert.ToDouble(selector(i));
double sum = SumAvg(values);
return Math.Sqrt(sum / (itemCount - 1));
}
return 0;
}
private static double SumAvg(IEnumerable<
double
> values)
{
double average = values.Average();
double sum = 0;
foreach (double item in values)
{
sum += Math.Pow(item - average, 2);
}
return sum;
}
}
public class StandardDeviationFunction : EnumerableSelectorAggregateFunction
{
protected override string AggregateMethodName
{
get
{
return "StdDev";
}
}
protected override Type ExtensionMethodsType
{
get
{
return typeof(Statistics);
}
}
}
void
customerAttributesGrid_AddingNewDataItem(
object
sender,
telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
var grid = e.OwnerGridViewItemsControl;
grid.CurrentColumn = grid.Columns[0];
}
I have a Radgrid and Datapager which is bound as the code below, the item source is a linq to sql class, the class is queried and the results are converted into a pivot table and both the pager and grid’s source properties are set and the grid has Aggregate Results and sort descriptors added this works well. I have a refresh button on the page but I can’t work out how to clear the pager and grid when the user clicks the button. I have tried your sample code but get errors. Could you please advise on the correct method.
<telerik:RadGridView x:Name="AgedJobsListgrid" ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Black" ShowColumnFooters="True" IsScrolling="False" IsTabStop="False" RowIndicatorVisibility="Collapsed" VerticalAlignment="Stretch" DataContext="{Binding ElementName=radDataPager}" RowHeight="35" FontSize="14"></telerik:RadGridView>
<telerik:RadDataPager x:Name="radDataPager" telerik:StyleManager.Theme="Office_Black"
PageSize="10"
DisplayMode="All"
IsTotalItemCountFixed="True" Source="{Binding AgedListClass}" DataContext="{Binding ElementName=AgedJobsListgrid}" />
‘code used to clear the pager and grid which fails when setting the itemsource to nothing.
radDataPager.Source = Nothing
AgedJobsListgrid.GroupDescriptors.Clear()
AgedJobsListgrid.ItemsSource = Nothing
AgedJobsListgrid.Columns.Clear()
AgedJobsListgrid.AutoGenerateColumns = True