I am creating a collection of columns in the viewmodel and successfully adding the columns to the TreeListView from the code behind in an event in the viewmodel.
CodeBehind
private void Vm_OnCompletedEvent(object sender, EventArgs e) { try { tvData.Columns.Clear(); foreach (GridViewDataColumn oCol in vm.ColumnList) { this.tvData.Columns.Add(oCol); } tvData.Rebind(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }The XAML in the View
<telerik:RadTreeListView x:Name="tvData" Margin="1" ItemsSource="{Binding TreeNodeDEList}" SelectedItem="{Binding SelectedTreeNodeDE,Mode=TwoWay}" AutoGenerateColumns="False" AutoExpandItems="True" IsFilteringAllowed="False" IsReadOnly="True" HierarchyIndent="8" FrozenColumnCount="1" RowStyleSelector="{StaticResource deRowSelector}" RowIndicatorVisibility="Collapsed"> <telerik:RadTreeListView.ChildTableDefinitions> <telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildNodes}" /> </telerik:RadTreeListView.ChildTableDefinitions> </telerik:RadTreeListView>The ViewModel code to create the columns
private void CreateColumns(){ try { string sUniqueName, sValuefield; GridViewDataColumn oCol; ColumnList = new List<GridViewDataColumn>(); oCol = new GridViewDataColumn(); oCol.HeaderCellStyle = HeaderStyle(); oCol.Width = 250; oCol.Header = "Category/Line Item"; oCol.UniqueName = "Rootcol"; oCol.DataMemberBinding = new System.Windows.Data.Binding("NodeLabel"); oCol.HeaderTextAlignment = TextAlignment.Left; oCol.TextAlignment = TextAlignment.Left; ColumnList.Add(oCol); int i = 1; foreach (WeekNoDB oWk in lWeekNo) { sUniqueName = string.Format("CellLabel{0}", i.ToString().PadLeft(2, '0')); sValuefield = string.Format("CellLabel{0}", i.ToString().PadLeft(2, '0')); oCol = new GridViewDataColumn(); oCol.HeaderCellStyle = HeaderStyle(); oCol.Width = 40; oCol.Header = string.Format("{0}/{1}", oWk.ToDate.DateTimeFromNull().Day, oWk.ToDate.DateTimeFromNull().Month); oCol.UniqueName = sUniqueName; oCol.DataMemberBinding = new System.Windows.Data.Binding(sValuefield); oCol.HeaderTextAlignment = TextAlignment.Center; oCol.TextAlignment = TextAlignment.Right; ColumnList.Add(oCol); i++; } if (this.OnCompletedEvent != null) { this.OnCompletedEvent(this, new EventArgs()); } } catch (Exception exc) { gUI.PopError(string.Format("{0}.{1}", this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod().Name), exc); }}
This works perfectly - ONCE
The second time i get the error
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Telerik.Windows.Controls.GridView.dll
Additional information: DataGrid_DisplayIndexOutOfRange
Astonishingly there is little response from Google, or my foo is not working. Any ideas how to fix this problem.
Hi,
If I want to convert a location point to an address I have to call the ReverseGeocodeAsync() method of the BingGeocodeProvider and pass a ReverseGeocodeRequest to it. However in R2 2017 this classes are deleted. And I didn’t find this classes in BingRestMapRouting.
Could you please tell me how to implement that ReverseGeocode logic in new version of telerik(R2 2017).
This is blocking us and need immediate help.
Thanx


Hello,
I'm new to the SpreadSheet control, I have used the standard example WPF code to create it as a user control.
Then I use this control in a RadWindow, and I want to add the data from DataTable from a database table with 72 columns and 110000 rows.
I use a simple loop to do this, since I have understood that databinding is not possible with a datatable on the SpreadSheet control.
When I try to load the data I get this message System.OutOfMemoryException.
I have browsed these posts, and so I also limitted the number of visble rows and columns to 80 x 100 but without success.
Can anyone tell me how I can do this correctly?
Basically I already moved away from the RadGridView since the RadGridView can not save to a Xlsx anymore, and the files that are generated are either not recognized by excel, or take too long too open with Excel.
So if anyone can give me a good way to export preferably with an intermediate grid, or otherwise a datatable to Excel in a Fast way, that keeps all the correct data types, and opens fast in Excel that would also be very helpfull.
Thanks,
André


Hello Telerik,
I am implementing a feature which consists of a list of user controls that can be dragged to dock panels.
At the moment there are two feature I need to implement. I've described the first one here http://www.telerik.com/forums/remove-the-not-allowed-icon-on-drag
then I also need to prevent the drag & drop of an item of the tree to itself.
Basically I need to restrict the drag&drop from tree to dockpanels only.
I will attach a screen shot of what i wish to prevent and my source code below
XAML
<Window x:Class="DashboardGrid.MainWindow" xmlns:local="clr-namespace:DashboardGrid" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="3*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <telerik:RadDocking Grid.Row="0" Grid.Column="0" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer > <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="1" Grid.Column="0" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer > <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="2" Grid.Column="0" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="0" Grid.Column="1" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="1" Grid.Column="1" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="2" Grid.Column="1" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="0" Grid.Column="2" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="1" Grid.Column="2" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> <telerik:RadDocking Grid.Row="2" Grid.Column="2" Drop="RadDocking_Drop" AllowDrop="True"> <telerik:RadSplitContainer> <telerik:RadPaneGroup> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> </Grid> <Grid Grid.Column="1"> <telerik:RadTreeView Grid.Row="1" Margin="5" VerticalAlignment="Stretch" AllowDrop="True" IsLineEnabled="False" IsEditable="True" IsDragDropEnabled="True"> <telerik:RadTreeViewItem Header="Telerik Input 2012 Q2" IsExpanded="true" AllowDrop="True"> <telerik:RadTreeViewItem Header="RadPdfViewer" AllowDrop="True" Name="RadPdfViewer" /> </telerik:RadTreeViewItem> <telerik:RadTreeViewItem Header="Telerik Visualization 2012 Q2" IsExpanded="true"> <telerik:RadTreeViewItem Header="RadChartview" Name="RadChartview" /> </telerik:RadTreeViewItem> <telerik:RadTreeViewItem Header="Telerik Data 2012 Q2" IsExpanded="true"> <telerik:RadTreeViewItem Header="RadDataFilter" Name="RadDataFilter" /> </telerik:RadTreeViewItem> </telerik:RadTreeView> </Grid> </Grid></Window>
Code behind
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using Telerik.Windows.Controls;using Telerik.Windows.Controls.TreeView;namespace DashboardGrid{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void RadDocking_Drop(object sender, DragEventArgs e) { var formats = e.Data.GetFormats(); var data = e.Data.GetData("TreeViewDragDropOptions"); var item = ((TreeViewDragDropOptions)data).DraggedItems.First(); var splitter = ((RadDocking)sender).Items[0]; RadPaneGroup group = (RadPaneGroup)((RadSplitContainer)splitter).Items[0]; switch (((RadTreeViewItem)item).Name) { case "RadPdfViewer": group.AddItem(new RadPane() { Content = new UserControl1(), Header = "uc1" }, Telerik.Windows.Controls.Docking.DockPosition.Center); break; case "RadChartview": group.AddItem(new RadPane() { Content = new UserControl2(), Header = "uc2" }, Telerik.Windows.Controls.Docking.DockPosition.Center); break; case "RadDataFilter": group.AddItem(new RadPane() { Content = new UserControl3(), Header = "uc3" }, Telerik.Windows.Controls.Docking.DockPosition.Center); break; } } private void RadTreeView_DragOverTree(object sender, DragOverTreeEventArgs e) { e.Handled = true; e.IsCanceled = true; } }}Thank you
Hi
Iam using GridViewToggleRowDetailsColumn ,in that column I am showing one user control. I tried to set the width of usercontrol to the width of the row but it is not working.
<MyUserControl:MyControl Width="{Binding Width,RelativeSource={RelativeSource AncestorType=telerik:GridViewRow}}" />
I didn't Keep any width property for my usercontrol.
Please suggest how can I achieve?
Hello Telerik,
I am implementing a feature which consists of a list of user controls that can be dragged to dock panels.
however, as you can see in the attached picture, there is this red "not allowed"-like icon showing, although the functionality works fine.
I just need to remove that icon. is there a way to do so?
Thank you
Hello Telerik,
I came across a scenario of which i need to change the mouse cursor (from pointer to hand) if the user hovers a specific type of cell.
After browsing your forums, I found the following solution:
GridControl.AddHandler(MouseMoveEvent, new MouseEventHandler(OnMouseMove), true);private void OnMouseMove(object sender, MouseEventArgs e){ var cell = (e.OriginalSource as FrameworkElement).ParentOfType<GridViewCell>(); if (cell != null) { switch (cell.Column.UniqueName) { case "UserName": Mouse.OverrideCursor = Cursors.Hand; break; default: Mouse.OverrideCursor = Cursors.Arrow; break; } } else { Mouse.OverrideCursor = Cursors.Arrow; }}
It works, however, the cursor will remain a pointer when trying to resize the column widths.
is there an easy way to prevent this? to have the user being able to resize the columns once again?
Thank you