Telerik Forums
UI for WPF Forum
1 answer
218 views

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. 

Dilyan Traykov
Telerik team
 answered on 30 May 2017
1 answer
121 views

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

Dinko | Tech Support Engineer
Telerik team
 answered on 29 May 2017
1 answer
142 views
Hello, 

I've noticed that the alert "freezes" when hovering the mouse on it, so that it doesn't disappear, and its duration time is reset and start counting again after the mouse stops hover on it.

Can this behavior be controlled or cancelled?
Dinko | Tech Support Engineer
Telerik team
 answered on 29 May 2017
2 answers
251 views
Consider Internet Explorer 9.0 (and possibly other browsers too). When you start dragging a tab you get the possibility to detach it from the main window and move/drop it into what becomes a new main window.

Can this be done using RadTabControl?
steven
Top achievements
Rank 1
 answered on 29 May 2017
1 answer
311 views

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é

 

 

Tanya
Telerik team
 answered on 26 May 2017
1 answer
109 views
Is it possible to switch on automatic hyphenation in the RadRichTextBox, as we're migrating an application from MS Word to using this control embedded in the system, and the hyphenation changes the number of lines that the text takes up.
Peshito
Telerik team
 answered on 26 May 2017
3 answers
217 views

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"
        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

Jacob
Top achievements
Rank 1
 answered on 26 May 2017
3 answers
213 views

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?

 

Stefan
Telerik team
 answered on 26 May 2017
2 answers
885 views

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

Jacob
Top achievements
Rank 1
 answered on 26 May 2017
1 answer
526 views

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

Jacob
Top achievements
Rank 1
 answered on 26 May 2017
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
Slider
Expander
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
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?