Telerik Forums
UI for WPF Forum
1 answer
71 views
Hi,

I have a grid with all default settings related with Sorting. 
grid's ItemSource property is set to custom List<MyCalss> at run time. 
But when i click on column's header for sorting it clears grid data.


Thanks,
Bala
Bhalchandra
Top achievements
Rank 1
 answered on 10 Feb 2012
2 answers
145 views
I am using a RadGridView whose ItemsSource is bound to a DataTable.
 The reason for using DataTable is because the columns have to be generated dynamically based on user's selection.
 I've added Aggregate Functions to each columns and recalculate them when the data source changes.
 The RadGridView throws exceptions on certain conditions.
 
I've attached a sample application that reproduces the error.
 the application is contrived from the original application to include only the necessary part.
 (The original application uses MVVM pattern, and the recalculation of aggregates happens when the ItemsSource in the ViewModel changes.)
 there are 2 different errors that I've encountered so far.
 
here are the steps to reproduce the error.
 Error A
 1. set the 'number of data columns' at the top right corner to 2(default), click the 'Load' button 3 times.
 2. at the 3rd click, Telerik.Windows.Controls.GridView.GridViewFooterCell.AggregateResults_CollectionChanged throws exception.
 
Error B
 1. set 'Add Count Function to Time column' to true, 'number of data columns' to 2, then click the 'Load' button
 2. set 'number of data columns' to 1, then click the 'Load' button twice.
 3. at the 2nd click of Step 2, RadGridView.CalculateAggregates() throws exception.
 
hope you look into this error,
 and if you have a better solution on what I'm trying to achieve(dynamic column generation, calculate aggregates),
 please do suggest.
 
Thanks.

I've discovered that you can't attach solution files in this forum, so I'll put the code below.

Main.xaml
<Window x:Class="RadGridViewAggregateFunctionTest.MainView"
        Title="MainWindow" Height="350" Width="600">
    <Grid x:Name="grid">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="number of data columns : " VerticalAlignment="Center"/>
            <telerik:RadNumericUpDown x:Name="radNumericUpDown" IsInteger="True" ValueChanged="radNumericUpDown_ValueChanged"
                                      Value="2"/>
            <CheckBox Content="Add Count Function at Time column" VerticalAlignment="Center" Margin="20,0,0,0" Checked="CheckBox_Checked" />
            <Button x:Name="LoadButton" Grid.Row="0" Width="100"
                    Content="Load"
                    Margin="20,0,0,0" Click="LoadButton_Click"
                    />
        </StackPanel>
        <telerik:RadGridView x:Name="radGridView" Grid.Row="1" ItemsSource="{Binding}"
                             ShowColumnFooters="True" ShowGroupPanel="False">
        </telerik:RadGridView>
    </Grid>
</Window>


Main.xaml.cs
using System;
using System.Linq;
using System.Data;
using System.Windows;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using System.IO;
using System.Windows.Controls;
 
namespace RadGridViewAggregateFunctionTest
{
    public partial class MainView : Window
    {
        Random random = new Random();
        private const int TIME_COLUMN_INDEX = 0;
        int numberOfColumns = 0;
        bool shouldAddCountFunctionAtTimeColumn = false;
 
        public MainView()
        {
            InitializeComponent();
        }
 
        private void LoadButton_Click(object sender, RoutedEventArgs e)
        {
            radGridView.DataContext = GenerateTable();
             
            AddAggregateFunctions(radGridView);
        }
 
        private void AddAggregateFunctions(RadGridView gridView)
        {
            foreach (var column in gridView.Columns)
            {
                if (column.DisplayIndex == TIME_COLUMN_INDEX)
                {
                    if (shouldAddCountFunctionAtTimeColumn)
                    {
                        CountFunction countFunction = new CountFunction();
                        countFunction.Caption = "Count : ";
                        column.AggregateFunctions.Add(countFunction);
                    }
 
                    continue;
                }
 
                MinFunction minFunction = new MinFunction();
                minFunction.Caption = "Min : ";
                column.AggregateFunctions.Add(minFunction);
 
                MaxFunction maxFunction = new MaxFunction();
                maxFunction.Caption = "Max : ";
                column.AggregateFunctions.Add(maxFunction);
 
                AverageFunction averageFunction = new AverageFunction();
                averageFunction.Caption = "Average : ";
                column.AggregateFunctions.Add(averageFunction);
            }
 
            gridView.CalculateAggregates();
        }
 
        private DataTable GenerateTable()
        {
            DataTable table = new DataTable("My Table");
 
            GenerateColumns(table);
 
            GenerateRows(table);
 
            return table;
        }
 
        private void GenerateColumns(DataTable table)
        {
            DataColumn column = new DataColumn("Time", typeof(DateTime));
            table.Columns.Add(column);
 
            for (int i = 0; i < numberOfColumns; i++)
            {
                string columnName = Path.GetRandomFileName().Substring(0, 4);
                column = new DataColumn(columnName, typeof(float));
                table.Columns.Add(column);
            }
        }
 
        private void GenerateRows(DataTable table)
        {
            DataRow row;
 
            for (int i = 0; i < 20; i++)
            {
                row = table.NewRow();
 
                row["Time"] = DateTime.Now.AddSeconds(i);
 
                foreach (DataColumn column in table.Columns)
                {
                    if (column.ColumnName == "Time")
                    {
                        continue;
                    }
 
                    row[column.ColumnName] = (float)random.NextDouble() * 50;
                }
 
                table.Rows.Add(row);
            }
        }
 
        private void radNumericUpDown_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
        {
            Int32.TryParse(radNumericUpDown.Value.ToString(), out numberOfColumns);
        }
 
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            shouldAddCountFunctionAtTimeColumn = ((CheckBox)sender).IsChecked.Value;
        }
    }
}

SPE
Top achievements
Rank 1
 answered on 10 Feb 2012
2 answers
177 views
We are facing a problem with a WPF application which is excessively using Telerik Controls. One of our customers is not able to see any Telerik UI controls in the application.

Any ideas on this?
Mike
Top achievements
Rank 1
 answered on 09 Feb 2012
6 answers
303 views
I am using RadWindows in place of MessageBoxes in my application.  However, the RadWindow.Alert windows activated when they are shown.  In other words when they are shown I assume that I can press the Enter key and close them but this is not the case.  However if I click on the window and then press the Enter key the window is closed.

The RadWindow.Prompt does not seem to have this same issue however I am not setting any property specially on either.

I have tried using the Opened property to set focus on the RadWindow and the RadAlert but that shows an undesirable adorner around the element.  I would be fine with doing this on the button however it does not seem to appear in the visual tree.  There also appears to be no Activate method for the RadWindow nor is there a ShowActivated property.  I'm out of options at this point.  Is this a defect that should be logged?  Please advise.
Adam
Top achievements
Rank 1
 answered on 09 Feb 2012
2 answers
200 views
Currently I have 

 <telerik:GridViewDataColumn Header="{x:Static resources:Strings.XXXXXXXXXXXX}"
                                                IsFilterable="True"
                                                IsSortable="True"
                                                DataMemberBinding="{Binding Path=XXXXXXXXXXXXXXXX}"
                                                CellTemplate="{StaticResource XXXXXXXXXXXXX}" />

But I observe repeat values in the filter since the column contains repeat values.  How can I avoid this and make sure the filter contains only the unique values?  I am using MVVM.

Thanks
Gautam
Top achievements
Rank 1
 answered on 09 Feb 2012
5 answers
319 views
I wish to extend "Smooth scrolling". I have 9 charts in grid of 3x3. Want to have only one scroll-bar for all horizontal Axis. Attaching picture and comments. Let me know the best way to accomplish this.

 
Petar Marchev
Telerik team
 answered on 09 Feb 2012
4 answers
160 views
Hi,

Sometimes I get this issue when I scroll carousel items. See the attached image.

As you can see in the image, the correct order of items should be 1, 2, 3, 4, 5..
But somehow, 1 overlaps 2, and 5 overlaps 4.

Is there a fix for this?

Thanks,
Jog
Jog Rad
Top achievements
Rank 1
 answered on 09 Feb 2012
11 answers
535 views
How do I set the default, initial view for a PropertyGrid to display categorized/grouped instead of listed Alphabetically?

There is a property (SortAndGroupVisibility) for enabling the option to change this by the end user, but I see no means to directly set this in Xaml or code behind...


Pavel
Top achievements
Rank 1
 answered on 09 Feb 2012
3 answers
222 views
I've been tracking down a performance problem, and I have it trimmed down to a sample application.  For code I am using, see below.

Edit: This also repros in the "RadControls for WPF Q3 2011 SP1 Demos" package, using the "Scrolling 1 Billion Cells" example.

A) Scroll to the bottom of the RadGridView, so that the bottom-most row is in-view.
B) Attempt to resize the window.

At this point my entire OS hangs.  I am able to regain control of the OS by CTRL-ALT-DEL then cancelling.  At this point I can break the debugger and determine the code is within GridViewCellsPanel.MeasureCell (bottom of stack is GridViewDataControl.MeasureOverride).

I suspect the RadGridView is de-virtualizing when this happens, as the performance gets worse with more records.  While this is happening, I can watch in Task Manager that the CPU usage is pegging and the memory usage goes from about 50MB to about 600MB.

Any suggestions?  This will be a blocker since we do not experience this behavior in WPF's native DataGrid.

Thanks -
- Graeme

XAML:
<telerik:RadGridView ItemsSource="{Binding}" />

Sample class used:
public class Junk
{
    public int Prop0 { get; set; }
    public int Prop1 { get; set; }
    public int Prop2 { get; set; }
    public int Prop3 { get; set; }
    public int Prop4 { get; set; }
    public int Prop5 { get; set; }
    public int Prop6 { get; set; }
    public int Prop7 { get; set; }
    public int Prop8 { get; set; }
    public int Prop9 { get; set; }
    public int Prop10 { get; set; }
    public int Prop11 { get; set; }
}

Loaded Event Handler:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
    Random random = new Random();
    List<Junk> list = new List<Junk>();
    for (int index = 0; index < 50000; ++index)
    {
        list.Add(new Junk()
        {
            Prop0 = random.Next(),
            Prop1 = random.Next(),
            Prop2 = random.Next(),
            Prop3 = random.Next(),
            Prop4 = random.Next(),
            Prop5 = random.Next(),
            Prop6 = random.Next(),
            Prop7 = random.Next(),
            Prop8 = random.Next(),
            Prop9 = random.Next(),
            Prop10 = random.Next(),
            Prop11 = random.Next(),
        });
    }
    DataContext = list;
}
Vlad
Telerik team
 answered on 09 Feb 2012
1 answer
228 views
As title says, is it possible to scroll the scheduleview horizontally and/or vertically from code-behind in WPF?

As you can probably appreciate the scrollbars provided by the scheduleview are a little too small for a touchscreen application I'm working on so I'd like the user to be able to navigate around a scheduleview some other way.

EDIT: I should note that it's important for the user to be able to scroll despite the fact that I'm using resources for grouping. Basically - to provide the functionality the scrollbars do at the moment.
Daniel
Top achievements
Rank 1
 answered on 09 Feb 2012
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?