Telerik Forums
UI for WPF Forum
1 answer
123 views
I have in my .xaml the following code:

<telerik:RadGridView x:Name="radGridView1" IsReadOnly="True" Grid.Column="1" Grid.Row="1" Margin="0,0,0,5" Grid.RowSpan="3"
    <telerik:RadGridView.Columns> 
                
    <telerik:GridViewDataColumn Header="Mesa" DataMemberBinding="{Binding mesa}"
        <telerik:GridViewColumn.AggregateFunctions> 
            <telerik:CountFunction Caption="# Registros encontrados: " /> 
        </telerik:GridViewColumn.AggregateFunctions>      
    </telerik:GridViewDataColumn> 
    <telerik:GridViewDataColumn x:Name="efectivo" Header="efectivo" DataMemberBinding="{Binding efectivo}"
        <telerik:GridViewColumn.AggregateFunctions> 
            <telerik:SumFunction Caption="Total: " /> 
        </telerik:GridViewColumn.AggregateFunctions> 
    </telerik:GridViewDataColumn> 

    .
    .
    .
    .

the count function works but the sum function doesn't, it says in spanish something like "There isn't a 'Sum' method in the 'System.Linq.Enumerable' type, compatible with the specified arguments."
The ItemSource that i'm binding is an Arraylist that contains objects of an object type that i created.


ArrayList listaMesas = Oper_SoftCount.consultarFecha(dt); 
this.radGridView1.ItemsSource = listaMesas


and the other problem is that the columns that have the aggregate functions, duplicate.

<telerik:GridViewDataColumn Header="Mesa" DataMemberBinding="{Binding mesa}">
                    <telerik:GridViewColumn.AggregateFunctions>
                        <telerik:CountFunction Caption="# Registros encontrados: " />
                    </telerik:GridViewColumn.AggregateFunctions>     
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn x:Name="efectivo" Header="efectivo" DataMemberBinding="{Binding efectivo}">
                    <telerik:GridViewColumn.AggregateFunctions>
                        <telerik:SumFunction Caption="Total: " />
                    </telerik:GridViewColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
Rossen Hristov
Telerik team
 answered on 10 Dec 2009
2 answers
142 views
Hello

The SelectedItem property of the treeview does not always contain what I would expect.
Examples:
  1. Cancel Selection
    The ItemsSource property is bound to a collection containing A and B objects. I want that only the A object are selectable. The B objects are just for information. I use the following code:
    void radTreeView_PreviewSelected(object sender, Telerik.Windows.RadRoutedEventArgs e) 
      // get a reference to the item that will be selected   
      RadTreeViewItem itemToSelect = e.OriginalSource as RadTreeViewItem;   
     
      // check item that will be selected   
      if (itemToSelect != null && itemToSelect.Item is B) 
      { 
        e.Handled = true
      } 
    However, the SelectedItem property contains the B object afterwards. I would expect the SelectedItem property to be null.
  2. Remove the selected item from the bound collection
    If I remove the currently selected item from the bound collection, then the node has disappeard as I expected, but the SelectedItem property still contains the removed object. I would expect, that the SelectedItem property always contains objects that are also in the ItemsCollection or null otherwise.

How should I handle these use cases? Binding to another property?

Best regards,
Franziska
Franziska
Top achievements
Rank 1
 answered on 10 Dec 2009
0 answers
66 views
Our latest Q3 2009 SP1 release (version 2009.3.1208) uses WCF RIA Services Beta for Visual Studio 2008 SP1. In other words, you should install this WCF RIA Services to be able to load our demos locally.

Please use the URL above to go to the download page of WCF RIA Services Beta for Visual Studio 2008 SP1.
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 10 Dec 2009
1 answer
136 views
Hi there,

Has anybody else have had issues setting the DisplayDateEnd of the RadDatePicker to a date in the past? Whenever I do it, I get an ArgumentOutOfRangeException : Invalid DisplayDateEnd value. Paramter name: sender.

I'm using ver 2009.2.1002.35

Thank you very much,
Peter

PS - Here is the stack trace :
 at Telerik.Windows.Controls.RadCalendar.OnDisplayDateEndChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) in c:\Builds\WPF_Scrum\Input_WPF_2009_Q2_SP2\Sources\Development\Controls\Input\Calendar\RadCalendar.cs:line 3042
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
   at System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   .
   .
   .
Kaloyan
Telerik team
 answered on 10 Dec 2009
3 answers
282 views
Hello,

I need to change visual style of line chart. I want to change size and fill of circle points, lines between points may remain unchanged.

I'm not sure what control I should template, because changing template of whole telerik:Line destroys all the lines between points and also Y positions of points are wrong.

Some example, like in your Demo application (Custom Bar Template) would be great.

Thank you!


Dwight
Telerik team
 answered on 10 Dec 2009
1 answer
179 views
Hi Telerik

In the following xaml I have set up a RadGridView with two columns:

       <t:RadGridView ItemsSource="{Binding Persons}"  ActionOnLostFocus="CommitEdit" AutoGenerateColumns="False" > 
            <t:RadGridView.Columns> 
                <!-- Auto column --> 
                <t:GridViewDataColumn DataMemberBinding="{Binding Path=ID}"  /> 
                <!-- Manual column --> 
                <t:GridViewDataColumn DataMemberBinding="{Binding Name}"
                    <t:GridViewDataColumn.CellTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="{Binding Name}" /> 
                        </DataTemplate> 
                    </t:GridViewDataColumn.CellTemplate> 
                    <t:GridViewDataColumn.CellEditTemplate> 
                        <DataTemplate> 
                            <TextBox Text="{Binding Name,Mode=TwoWay}" /> 
                        </DataTemplate> 
                    </t:GridViewDataColumn.CellEditTemplate> 
                </t:GridViewDataColumn> 
            </t:RadGridView.Columns> 
        </t:RadGridView>       

This xaml was placed in a window with the following code behind:

using System.Collections.ObjectModel; 
using System.Windows; 
 
namespace WpfApplication2 
    /// <summary> 
    /// Interaction logic for MainWindow.xaml 
    /// </summary> 
    public partial class MainWindow : Window 
    { 
        public MainWindow()        { 
            InitializeComponent(); 
            this.DataContext = this
        } 
 
        public ObservableCollection<Employee> Persons 
        { get { return EmployeeService.GetEmployees(); } } 
 
    } 
    public class Employee    { 
        public int ID { getset; } 
        public string Name { getset; } 
    } 
    public class EmployeeService    { 
        public static ObservableCollection<Employee> GetEmployees() 
        { 
            ObservableCollection<Employee> employees = new ObservableCollection<Employee>(); 
            Employee employee = new Employee(); 
            employee.Name = "Maria"
            employee.ID = 24890; 
 
            employees.Add(employee); 
            employee = new Employee(); 
            employee.Name = "Ana"
            employee.ID = 23890; 
 
            employees.Add(employee); 
            employee = new Employee(); 
            employee.Name = "Antonio"
            employee.ID = 24890; 
 
            employees.Add(employee); 
            employee = new Employee(); 
 
            return employees; 
        } 
    } 
 

Now if you run this code you will notice that the two DataGrid columns behave differently when you are updating them. As I understand, when ActionOnLostFocus is set to "CommitEdit" the cell being edited should save its new value when it looses focus. The cells in the first column behave in this fashion, however those in the second column do not - Each reverts to its old value whenever it looses focus.

Why is this? How do I change the behavior of the cells in the second column so that each cell saves its new value when focus is transfered elsewhere?

Cheers

Bob
Nedyalko Nikolov
Telerik team
 answered on 09 Dec 2009
2 answers
233 views
When I update a field in a WPF datagrid that's associated with a dataset the corresponding field in the underlying datatable is also modified after I issue a commitedit.
When I delete a column in the grid the corresponding column in the datatable is still present. Am I responsible for deleting the datatable column or am I doing something wrong?

Jorge Gonzalez
Top achievements
Rank 1
 answered on 09 Dec 2009
4 answers
106 views
Hello,
I have a problem exporting to a text file while grouping the data.

<!-- Window1.xaml --> 
<Window x:Class="WpfTelerikRadGridViewTest.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window1" Width="800" Height="600" > 
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition /> 
            <RowDefinition Height="Auto" /> 
        </Grid.RowDefinitions> 
        <telerik:RadGridView Name="radGridView1" ItemsSource="{Binding}" /> 
        <Button Grid.Row="1" Click="ButtonBase_OnClick">Save</Button> 
    </Grid> 
</Window> 


// Window1.xaml.cs  
public partial class Window1  
{  
    public Window1()  
    {  
        InitializeComponent();  
 
        var list = new ObservableCollection<string>();  
 
        list.Add("HELLO1");  
        list.Add("HELLO2");  
        list.Add("HELLO3");  
        list.Add("HELLO4");  
        list.Add("HELLO5");  
 
        DataContext = list;  
    }  
 
    private void ButtonBase_OnClick(object sender, RoutedEventArgs e)  
    {  
        var s = radGridView1.ToText();  
    }  

When i press the save button the variable 's' gets the _correct_ value:
"\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\nHELLO5\r\n"

When i press the save button while grouping the column i get the following value on 's': 
"\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\nHELLO5\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\n\r\nHELLO1\r\n\r\nHELLO1\r\nHELLO2\r\nHELLO3\r\nHELLO4\r\nHELLO5\r\n"

This means that i cant export a grid if the user is grouping. I thought that it would generate a sorted grid. This behavior also applies to ToHtml.
Robert
Top achievements
Rank 1
 answered on 09 Dec 2009
2 answers
132 views
how can i make the Text inside  the GridViewDataColumn.Header wrap?

i think something can be done with the GridViewHeaderCell but i didn't managed to make it work

igal a
Top achievements
Rank 1
 answered on 09 Dec 2009
5 answers
151 views
Hi everybody,

I am trying to set up RadGridView as a multi-column tree-view for a self-referencing scenario. I need to make grid columns to be aligned for all the child and parent rows. So if I drag a column gridline then I would expect the gridline to stay straight across all the rows, both parent and child. We are talking about the same column and I need it to behave like one. How can I do this?
Also, when I set frozen columns then child rows would keep sliding past the freeze line (I guess this is part of the same task: treat parent and child columns with the same name as the same visual column).

The final task is when I can get this 'same column' behavior then I need to be able to sort, filter, etc, i.e. do common grid operations.
(Note: I can sort on different columns in the 'SelfReference' example in the Examples_WPF.CS demo but the result of sorting does make much sense when you expand child rows).

Has anybody been able to address this task before? Could you please share your experience/knowledge?

Regards,
g8r.
Gennady Ralko
Top achievements
Rank 1
 answered on 09 Dec 2009
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?