Telerik Forums
UI for WPF Forum
9 answers
452 views
Hi,

I am working with Telerik Self-referencing RadGridView. RadGridView displays hierarchial manner. When a record in the RadGridView is expanded, I intend to make a database query via WCF service. I then wish to populate the parent record (the one being expanded) with the newly fetched child record. Hence the ObservableCollection<> of records are created at run-time when the user expands particular record of the grid.
I could successfuly fetch the base record (records at level 0) and display it. Root record has a dummy child which is refreshed when the user expands the root record. Once the child records are available, I change the root record's data binding with the new child record (root.ChildNode = childNodeCollection to build the hierarchy). However, when I change the child record of the parent (parent.ChildNode = null initially and then later on set to childNodeCollection), I want to refresh the grid view. How do i accomplish this ? Invoking RadGridView.ReBind() collapses all the currently expanded rows which I want to avoid!

Milan
Telerik team
 answered on 11 Nov 2009
3 answers
188 views
Hi,

I don't get an answer for this issue. So, I have to re-post it again. Hope someone can help me out here.

The sample Telerik gave is not the same case as my application. The sample is quite simple. Load 100 rows, select a row and then scrollIntoView.

My case is:

Let's say I have 10 records in the collection which is binding to the grid. I added one more record to the collection. grid.items.count turns to 11. SelectedItem goes to the newly added one. Then I tried to scrollIntoView this newly added record. It gave me the below error message. It seems although the grid recognize the newly added record, the ScrollIntoView does not know this item. 

"Object reference not set to an instance of an object."

at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)\r\n   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.InsertNewContainer(Int32 childIndex, UIElement container)\r\n   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)\r\n   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.BringIndexIntoView(Int32 index)\r\n   at Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollRowIntoView(Object item)\r\n   at Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollIntoView(Object item)\r\n  

Milan
Telerik team
 answered on 11 Nov 2009
1 answer
66 views
When I set the RadGridView to AutoGenerateColumns It generates columns for all Properties in my object even Properties that are Collections or IEnumerable. Is there a way to disable AutoGenerating IEnumerable Columns? Pretty much all of my Objects have relation properties that are IEnumerable.
Vlad
Telerik team
 answered on 11 Nov 2009
3 answers
100 views
Hello everybody,
I have a RadGridView with the itemssource set to an observable collection typed on a Linq table.
When this is empty, if I scroll with the mouse wheel when the mouse is in the grid area, the application generates an exception that I am not able to handle.
How can I avoid this?

Thanks a lot in advance for your interesting.

Nick
Vlad
Telerik team
 answered on 11 Nov 2009
1 answer
82 views
Hi,

Player_AllPlayers_GridView control inherits from the RadGridView and its ItemSource is set to an ObsarvableCollection maintained in a web service tier. In general everything works properly. I just cannot get control over my customised sorting. Since, I am using my own paging scheme, I would like to capture the Sorting event. Therefore, I am attaching a handler for it (see below). Then, in the handler I retrieve the items that I am interested in which are already sorted on the server. The RadGridView does display the new items correctly. Unfortunatelly, it does its OWN sorting beforhand. Setting e.Handled = true does not change anything, the "internal" sorting still happens first and my sorting afterwards.
The second question is about the DataLoaded event. It is executed after each row is loaded for the RadGridView. Is there an event that is executed (only once) after all rows have been loaded?

public partial class MainContent()
{
    Player_AllPlayers_GridView grid;
    [...]

    public  MainContent()
    {
        InitializeComponent();
  
        //I am feeding an ObservableCollection reference to the RadGridView
        grid = new Player_AllPlayers_GridView(MainPage.webservices.WebService.ProfileList);
        grid.DataLoaded += grid_DataLoaded;
        grid.Sorting += grid_Sorting;
    }
}

void grid_Sorting(object sender, Telerik.Windows.Controls.GridViewSortingEventArgs e)
{
    string sortDesc = e.SortPropertyName;
    if (e.NewSortingState == Telerik.Windows.Controls.SortingState.Descending)
        sortDesc += "_desc";
    // Here I am just repopulating the ObservableCollection that is assigned to this grid
    HeaderClickRetrieveSortedProfiles(sortDesc);
    e.Handled = true;
}

void grid_DataLoaded(object sender, EventArgs e)
{
        [...]
}

regards, Przemek
Rossen Hristov
Telerik team
 answered on 11 Nov 2009
1 answer
128 views
Ok.  I have a small project open (only copy of VS open) and when I start it up I am using 2gb when idle.  After loading my project with the new WPF controls everything seems fine right off the bat.  After developing for around 30 minutes I notice that my project is lagging extremely bad (taking 10 seconds to come back where I can type).  I take a look at my task manager and I am now at 3.5 GIGS when idle.
This only seems to happen with the new WPF controls loaded.
I have the following libraries loaded in my project:
 - Telerik.Windows.Controls
 - .Controls.Gridview
 - .Controls.Input
 - .Controls.Navigation
 - .Controls.RibbonBar (possible suspect)
 - Telerik.Windows.Data

The controls that I am actually using my small project are:
 - RadGrid
 - RadRibbon
 - RadRibbonGroup
 - RadRibbonTab
 - RadRibbonButton
 - and other base WPF controls like normal textblock's and whatnot.

I have before and after photo's of my machine's task manager to show stats if needed.

This is a really big problem because I am having to restart my VS instance every 20-40 minutes (sometimes as little as 10 minutes).
Has anyone else had this problem?  Is this a known issue?
Milan
Telerik team
 answered on 11 Nov 2009
3 answers
640 views
Hello

I'm using a details template for a row as follows:
<DataTemplate x:Key="DiscussionDetailsTemplate"
            <Grid> 
                <Grid.ColumnDefinitions> 
                    <ColumnDefinition Width="Auto" /> 
                    <ColumnDefinition Width="*" /> 
                </Grid.ColumnDefinitions> 
                <Grid.RowDefinitions> 
                    <RowDefinition Height="Auto"/> 
                </Grid.RowDefinitions> 
                <TextBlock Grid.Row="0" Grid.Column="0" Text="Discussion Text: " Margin="12,0,0,0" FontSize="13" FontWeight="Bold" /> 
                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding mNotes}" TextWrapping="Wrap" FontSize="13" Margin="12,0,0,0" HorizontalAlignment="Left" /> 
            </Grid> 
        </DataTemplate> 

Basically, the details template shows a potentially long message in a discussion.  Here's the code for the grid using the template:

<telerik:RadGridView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Name="DiscussionListGridView" Style="{DynamicResource DefaultGrid}"  
                                 ItemsSource="{Binding DiscussionList}" SelectedItem="{Binding SelectedDiscussion}" AutoGenerateColumns="False"  
                                 ScrollMode="RealTime" DataLoadMode="Synchronous" CanUserSortColumns="True"  
                                 RowDetailsVisibilityMode="VisibleWhenSelected" RowDetailsTemplate="{StaticResource DiscussionDetailsTemplate}" 
                                 > 
                <telerik:RadGridView.Resources> 
                    <Style TargetType="telerik:RadGridView"
                        <Setter Property="ShowGroupPanel" Value="False"/> 
                    </Style> 
                </telerik:RadGridView.Resources> 
 
                <telerik:RadGridView.Columns> 
                    <telerik:GridViewDataColumn Width="Auto" Header="From" Name="AuthorName" IsReadOnly="True" DataMemberPath="sgAuthorName"  
                                                TextWrapping="Wrap"  /> 
                    <telerik:GridViewDataColumn Width="*" Header="Subject" Name="Subject" IsReadOnly="True" DataMemberPath="sgDescription"  
                                                TextWrapping="Wrap" /> 
                    <telerik:GridViewDataColumn Width="Auto" DataFormatString="{}{0:dd/MM/yyyy}" Header="Date" Name="StatusDateDue"  
                                                IsReadOnly="True" DataMemberPath="dtDateCreated" TextWrapping="Wrap"  /> 
                </telerik:RadGridView.Columns> 
            </telerik:RadGridView> 

The problem that I'm having is that if the text is particularly long in the row details view, it won't wrap automatically.  Instead it forces a scrollbar at the bottom of the grid and makes the user manually scoll - this isn't my desired behaviour.

Any tips on how to cause the text to wrap correctly?



James
Top achievements
Rank 1
 answered on 11 Nov 2009
4 answers
125 views
Hi

I'm trying to get a custom hierarchy going in the new Q3 Gridview.  The examples don't explain how to do this properly (the example under Custom Hierarchy is actually a Property Hierarchy).

Here's how I did it in the previous version:

        public FailedMessagesView() 
        { 
            InitializeComponent(); 
            FailedFaxGrid.TableDefinition.PreviewDataRecordCreate += FailedFaxTableDefinition_PreviewDataRowCreate; 
        } 
 
        private void FailedFaxTableDefinition_PreviewDataRowCreate(object sender, DataRecordCreateEventArgs e) 
        { 
            FailedMessagesViewModel fmVM = (FailedMessagesViewModel)DataContext; 
            SuppliersEntity theSupplier = (SuppliersEntity)e.Data; 
            ObservableCollection<MessagesCheckedEntity> theMessages = new ObservableCollection<MessagesCheckedEntity>
                fmVM.FailedFaxes.Where(m => m.fkidSupplier == theSupplier.idSupplier).ToList()); 
            if (theMessages.Count > 0) 
            { 
                e.IsExpandableRecord = true
                GridViewTableDefinition ffDefs = new GridViewTableDefinition(); 
                ffDefs.AutoGenerateFieldDescriptors = false
                ffDefs.DataSource = theMessages
 
                GridViewDataColumn checkBox = new GridViewDataColumn(); 
                checkBox.Name = "FailedFaxCheckValName"
                checkBox.Header = " "
                checkBox.IsFilterable = false
                checkBox.IsGroupable = false
                checkBox.IsReadOnly = true
                checkBox.CellStyle = (Style)FailedFaxGrid.FindResource("checkValueStyle"); 
                checkBox.Width = GridViewLength.Auto; 
                ffDefs.FieldDescriptors.Add(checkBox); 
 
                GridViewDataColumn JobNo = new GridViewDataColumn(); 
                JobNo.Name = "FailedFaxJobNoName"
                JobNo.Header = "Job"
                JobNo.IsFilterable = false
                JobNo.IsGroupable = false
                JobNo.IsReadOnly = true
                JobNo.DataMemberBinding = new Binding("DataRow[sgCommonName]"); 
                JobNo.Width = GridViewLength.Auto; 
                ffDefs.FieldDescriptors.Add(JobNo); 
 
                GridViewDataColumn task = new GridViewDataColumn(); 
                task.Name = "FailedFaxTaskName"
                task.Header = "Task"
                task.IsFilterable = false
                task.IsGroupable = false
                task.IsReadOnly = true
                task.DataMemberBinding = new Binding("DataRow[sgItemName]"); 
                task.Width = GridViewLength.Auto; 
                ffDefs.FieldDescriptors.Add(task); 
 
                GridViewDataColumn TaskNotes = new GridViewDataColumn(); 
                TaskNotes.Name = "TaskNotes"
                TaskNotes.Header = "Task Notes"
                TaskNotes.IsFilterable = false
                TaskNotes.IsGroupable = false
                TaskNotes.IsReadOnly = true
                TaskNotes.DataMemberBinding = new Binding("DataRow[mNotes]"); 
                TaskNotes.Width = new GridViewLength(1, GridViewLengthUnitType.Star); 
                TaskNotes.TextWrapping = TextWrapping.Wrap; 
                ffDefs.FieldDescriptors.Add(TaskNotes); 
 
                GridViewDataColumn ReceiptDetails = new GridViewDataColumn(); 
                ReceiptDetails.Name = "ReceiptDetails"
                ReceiptDetails.Header = "Failure Reason"
                ReceiptDetails.IsFilterable = false
                ReceiptDetails.IsGroupable = false
                ReceiptDetails.IsReadOnly = true
                ReceiptDetails.DataMemberBinding = new Binding("sgReciptDetails"); 
                ReceiptDetails.Width = new GridViewLength(1, GridViewLengthUnitType.Star); 
                ReceiptDetails.TextWrapping = TextWrapping.Wrap; 
                ffDefs.FieldDescriptors.Add(ReceiptDetails); 
                e.ChildTableDefinitions.Add(ffDefs); 
            } 
        } 

A warning pops up telling me that this method is obsolete, and doing it this way no longer works.
James
Top achievements
Rank 1
 answered on 11 Nov 2009
1 answer
109 views
I am trying to change the chart type used in the Grouping and Aggregation demo from a Bar to a Line and recieve the following error. 'SelfDrawingSeries' TargetType does not match type of element 'Line' when I try to run it.

The only change I have made to the example code is on this line:
mapping1.SeriesDefinition = new BarSeriesDefinition(); 
 
Changed to 
 
mapping1.SeriesDefinition = new LineSeriesDefinition(); 

This also happens with the SplineSeries as well.

Am I missing something or is this a bug?

Thanks

Edit: I should have mentioned I am using the 10/23 Beta 2 build
David
Top achievements
Rank 1
 answered on 11 Nov 2009
1 answer
94 views
I have two grid's where I can dragdrop from "grid 1" to "grid2", I can drop and insert anywere in the grid (all works fine) but I can only drop in the rows I see.

I need the grid to scroll down if I try to drop at the bottom of the rows, and scroll up if I drop at the top row.

How do I code that in C# (I'm using "RadDragAndDropManager")

Kennet
Top achievements
Rank 2
 answered on 10 Nov 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?