or
public
partial
class
MainWindow
{
public
MainWindow()
{
InitializeComponent();
Closing += MainWindowClosing;
}
void
MainWindowClosing(
object
sender, CancelEventArgs e)
{
e.Cancel =
true
;
busyIndicator.IsBusy =
true
;
var worker =
new
BackgroundWorker()
;
worker.DoWork += (s, args) => Thread.Sleep(TimeSpan.FromSeconds(3));//just for testing
worker.RunWorkerCompleted += (s, args) =>
{
busyIndicator.IsBusy =
false
;
e.Cancel =
false
;
};
worker.RunWorkerAsync();
}
}
FrameworkElementFactory radGridView =
new
FrameworkElementFactory(
typeof
(RadGridView));
radGridView.SetValue(RadGridView.ShowGroupPanelProperty,
false
);
radGridView.SetValue(RadGridView.ShowInsertRowProperty,
false
);
Telerik.Windows.Controls.GridViewColumnCollection colCollection =
new
Telerik.Windows.Controls.GridViewColumnCollection();
GridViewDataColumn dc =
new
GridViewDataColumn();
dc.Header =
"test"
colCollection.Add(dc);
radGridView.SetValue(RadGridView.Columns,colCollection);
<telerik:GridViewDataColumn DataMemberBinding="{Binding HubAssemblyNumber}" FooterCellStyle="{StaticResource GridViewFooterCellStyle1}"> <telerik:GridViewDataColumn.Header> <TextBlock Style="{StaticResource centeredHeaderTextBoxStyle}"> <TextBlock.Inlines> <Run>Assembly</Run> <LineBreak /> <Run>Number</Run> </TextBlock.Inlines> </TextBlock> </telerik:GridViewDataColumn.Header> <telerik:GridViewDataColumn.AggregateFunctions> <telerik:CountFunction Caption="Count: " ResultFormatString="{StaticResource commaFormat}" /> </telerik:GridViewDataColumn.AggregateFunctions> <telerik:GridViewDataColumn.Footer> <telerik:AggregateResultsList ItemsSource="{Binding}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" > <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock HorizontalAlignment="Center" Text="{Binding FormattedValue}" /> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid HorizontalAlignment="Center" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </telerik:AggregateResultsList> </telerik:GridViewDataColumn.Footer> </telerik:GridViewDataColumn>
<Style x:Key="GridViewFooterCellStyle1" TargetType="{x:Type telerik:GridViewFooterCell}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type telerik:GridViewFooterCell}"> <Border x:Name="PART_FooterCellBorder" <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" /> </Border> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Stretch" /> </Style>
I’m currently in the process of evaluating the RadGrid.
If I add aggregates to the radgrid can I get the aggregate output to display at the bottom of the row as opposed to along side the grouping label. At the very least can I get the information to go above the row that’s being aggregated.
For example in the samples you have a table with a column called quantity, I want to sum the quantity column by adding an aggregate (which is simple to do) and I want to display the sum value below all the quantity values for the grouping, how ever its currently being displayed beside the label.
Thanks
var dynamicObject = collectionView.ElementAt(0) as System.Dynamic.IDynamicMetaObjectProvider; var metaObject = dynamicObject.GetMetaObject(System.Linq.Expressions.Expression.Constant(dynamicObject));