Telerik Forums
UI for WPF Forum
6 answers
105 views
We are using Telerik WPF contorls for the desktop application (2013 Q3 NET).

We have few column groups in the grid and columns are sorted to them. We need to be able to prevent the user from moving the column from one ColumnGroup to the other. They should however be able to reorder columns as long as the column remains in the original ColumnGroup.

Thank you!
Nikolay
Top achievements
Rank 1
 answered on 11 Mar 2016
3 answers
134 views

Dear Telerik Support
I just started using your controls for WPF, to see if it suits the needs of our company
Starting by doing basic examples, I stumbled upon the RadGridView pagination
I am trying to use this example
http://demos.telerik.com/silverlight/#DomainDataSource/MVVM and
and this documentation
http://docs.telerik.com/devtools/wpf/controls/raddatapager/getting-started#adding-raddatapager
But it seems my grid wont page if I dont use this

   this.view = new QueryableDomainServiceCollectionView<Customer>(context, getCustomersQuery);
   
   this.view.PageSize = 10;

thus attributing the PageSize to it.
right now I use a ObservableCollection<Entity> List.

So my question is: Where how can I use the above mentioned class (QueryableDomainServiceCollectionView) to support my need of pagination?
I don't want to paginate it manually, by using the Unbound mode. and I would prefer to avoid that all data goes into memory

I wish I could attach a zip file of my project. but since I cannot, here is the code (note: you must install the PropertyChanged.Fody nugget in order to run it):

XAML

<Window x:Class="TelerikWpfApp1.MainWindow"
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"
xmlns:local="clr-namespace:TelerikWpfApp1"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid Name="grid">
<Grid.DataContext>
<local:ViewModel/>
</Grid.DataContext>
<telerik:RadGridView x:Name="radGridView"
HorizontalAlignment="Left"
Margin="23,30,0,0" VerticalAlignment="Top"
Height="234" Width="468"
ItemsSource="{Binding List}" AutoGenerateColumns="True">
<telerik:RadGridView.Columns>
<telerik:GridViewColumn BindingGroup="{Binding id}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<telerik:RadDataPager x:Name="radDataPager"
Margin="23,264,26,27"
PageSize="5"
DisplayMode="PreviousNext"
Source="{Binding List, ElementName=radGridView}" />
</Grid>
</Window>

XAML.CS

 
using System.Windows;
namespace TelerikWpfApp1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
ViewModel vm = null;
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
vm = grid.DataContext as ViewModel;
vm.Load();
}
}

 

VIEWMODEL.cs

using PropertyChanged;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace TelerikWpfApp1
{
[ImplementPropertyChanged]
public class ViewModel
{
public ObservableCollection<Entity> List { get; set; }
public void Load()
{
List = GetList().ToObservableCollection();
}
List<Entity> GetList()
{
List<Entity> list = new List<Entity>();
for (int i = 0; i < 100; i++)
{
list.Add(new Entity() { comment = "dasd", id = 1, name = "fefe" });
list.Add(new Entity() { comment = "xxcv", id = 2, name = "dewd" });
list.Add(new Entity() { comment = "zzz", id = 3, name = "jjj" });
}
return list;
}

//public void Save(Entity item, string comment)
//{
// if (item.comment != comment)
// {
// //controller.Save(); }
// }
//}
}
public class Entity
{
public int id { get; set; }
public string name { get; set; }
public string comment { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
public static class ListExtensions
{
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> items)
{
var c = new ObservableCollection<T>();
foreach (var item in items)
{
c.Add(item);
}
return c;
}
}
}

 

Thank you!!!!

Vitor
Top achievements
Rank 1
 answered on 11 Mar 2016
3 answers
327 views

I am working through your documentation and am trying to get the 2nd TimeSpanPicker working. 

<telerik:RadTimeSpanPicker x:Name="Duration"  Value="{Binding SelectedDuration, Mode=TwoWay}"...

My implementation (different source & different name):

<telerik:RadTimeSpanPicker
    Grid.Row="1"
    x:Name="Duration" 
    Value="{Binding SelectedDuration, Mode=TwoWay}"
    StringFormat="hh\:mm' hours'"
    TimeSpanWatermarkContent="Select duration...">
    <telerik:RadTimeSpanPicker.TimeSpanComponents>
        <wpf:TimeSpanDurationComponent
            ItemsSource="{Binding Durations, Mode=OneWayToSource}"
            Header="Minutes"/>
    </telerik:RadTimeSpanPicker.TimeSpanComponents>
</telerik:RadTimeSpanPicker>

I added the DurationTimeSpanComponent (wpf.TimeSpanDurationComponent) and have the Durations collection on my MV.

However, I get this error during runtime:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Durations; DataItem=null; target element is 'TimeSpanDurationComponent' (HashCode=46098163); target property is 'ItemsSource' (type 'IEnumerable')

Your example includes that control is a container.  Is that important? 

What I see is that you include a namespace that doesn't seem to be part of my install.  When I attempt to set this xmlns I don't have it as an option.  And, when I go to add a reference this is not part listed.  Is the documentation bad?  Is this QuickStart namespace supposed to be part of most common implementations?

xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=QuickStart.Common"

Nasko
Telerik team
 answered on 11 Mar 2016
3 answers
68 views
Hello,

I'm using a RadGridView, and in it's footer, a textbox element inside a GroupFooterTemplate. Can I, from codebehind, in a TextBox event (e.g. TextChanged) somehow access the GridView that contains my TextBox? When I check the sender's properties, the parent is null.

Also, can I somehow access the group information and the other groups' TextBoxes?

Any help would be appreciated.
Stefan
Telerik team
 answered on 10 Mar 2016
1 answer
47 views

Dear Telerik Support

I just started using your controls for WPF, to see if it suits the needs of our company

Starting by doing basic examples, I stumbled upon the RadGridView pagination

I am trying to use this example

http://demos.telerik.com/silverlight/#DomainDataSource/MVVM and

and this documentation

http://docs.telerik.com/devtools/wpf/controls/raddatapager/getting-started#adding-raddatapager

But it seems my grid wont page if I dont use this

   this.view = new QueryableDomainServiceCollectionView<Customer>(context, getCustomersQuery);
   
   this.view.PageSize = 10;

thus attributing the PageSize to it.

right now I use a ObservableCollection<Entity> List.

 

So my question is: Where how can I use the above mentioned class (QueryableDomainServiceCollectionView) to support my need of pagination?

I don't want to paginate it manually, by using the Unbound mode. and I would prefer to avoid that all data goes into memory

 

I will attach the code of my sample project here. Not you must install the PropertyChanged.Fody in order to run it.

Stefan
Telerik team
 answered on 10 Mar 2016
2 answers
145 views
<t:RadGridView x:Name="Logs">
   <t:RadGridView.Columns>
       <t:GridViewDataColumn CellTemplateSelector="{StaticResource IconTemplateSelector}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding LogLevel,Mode=OneWay}" Header="Level"
                        CellStyle="{StaticResource PaddedCell}"/>                
       <t:GridViewDataColumn DataMemberBinding="{Binding LogID,Mode=OneWay}" 
                        Header="LogID"/>
       <t:GridViewDataColumn DataMemberBinding="{Binding MachineDateTime,Mode=OneWay}"
                        Header="Machine Time"
                        CellStyle="{StaticResource PaddedCell}"/>
       <t:GridViewDataColumn DataMemberBinding="{Binding Occured, Mode=OneWay}"
                        Header="Occured" 
                        CellStyleSelector="{StaticResource ColorSelector}"/>
       <t:GridViewDataColumn DataMemberBinding="{Binding System,Mode=OneWay}"
                        Header="System"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding Mode,Mode=OneWay}"
                        Header="Mode"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding CallingClass,Mode=OneWay}"
                        Header="Calling Class"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding Message,Mode=OneWay}"
                        Header="Message"
                        CellStyle="{StaticResource PaddedCell}" />
       <t:GridViewDataColumn DataMemberBinding="{Binding Exception,Mode=OneWay}"
                        Header="Exception" 
                        CellStyle="{StaticResource PaddedCell}" /> 
   </t:RadGridView.Columns>                     
</telerik:RadGridView>

 

I have above data-bound RadGridView (named Logs) and I am trying to export its contents, but it always results into an empty exported file.

And I try to export the contents of RadGridView with below code:

private void ExportLogs()
{
    using (var stream = File.Create(filepath))
    {
          Logs.Export(stream,
                 new GridViewExportOptions()
                 {
                     Format = ExportFormat.ExcelML,
                     ShowColumnHeaders = true,
                     ShowColumnFooters = false,
                     ShowGroupFooters = false,
                 });   
     }
 }

No exceptions or warning received.
Any help would be appreciated. Thank you.
Niraj
Top achievements
Rank 1
 answered on 10 Mar 2016
1 answer
201 views

Hello

Why this doesn't work?

 

It causes the following exception: 

An unhandled exception of type 'System.NullReferenceException' occurred in Telerik.Windows.Controls.FixedDocumentViewers.dll

em Telerik.Windows.Controls.FixedDocumentViewerBase.AttachToDocumentEvents(RadFixedDocument document)
em Telerik.Windows.Controls.FixedDocumentViewerBase.OnDocumentChanged(RadFixedDocument oldValue, RadFixedDocument newValue)
em Telerik.Windows.Controls.FixedDocumentViewerBase.<.cctor>b__1(DependencyObject s, DependencyPropertyChangedEventArgs e)
em System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
em System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
em System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)

 

Tanya
Telerik team
 answered on 10 Mar 2016
3 answers
112 views
 
I Would like to bind title/header beginning of each line of chart from data source.I already binded with required display with legend and it is working fine but i need help to display at beginging of each line series.Please help it..please refer image...
 
<telerik:RadCartesianChart.SeriesProvider>               
             <telerik:ChartSeriesProvider Source="{Binding Data}">                   
                 <telerik:ChartSeriesProvider.SeriesDescriptors>
                     <telerik:CategoricalSeriesDescriptor  ItemsSourcePath="LineData" ValuePath="Value" CategoryPath="Vector" >
                         <telerik:CategoricalSeriesDescriptor.Style>
                             <Style TargetType="telerik:StepLineSeries">
                                 <Setter Property="StrokeThickness" Value="2"/>
                                 <Setter Property="ShowLabels" Value="False"/>
                                 <Setter Property="PointTemplate" Value="{StaticResource LinePointTemplate}"/>
                                 <Setter Property="LegendSettings">
                                     <Setter.Value>
                                         <telerik:SeriesLegendSettings  x:Name="l" Title="{Binding Name}"/>
                                     </Setter.Value>
                                 </Setter>
                                 <Setter Property="VerticalAxis">
                                     <Setter.Value>
                                         <telerik:LinearAxis Title="{Binding Name}" LabelTemplate="{StaticResource YLabelTemplate}"   
                                   />
                                     </Setter.Value>
                                 </Setter>
                             </Style>
                          
                         </telerik:CategoricalSeriesDescriptor.Style>
                     </telerik:CategoricalSeriesDescriptor>
                 </telerik:ChartSeriesProvider.SeriesDescriptors>                   
             </telerik:ChartSeriesProvider>
         </telerik:RadCartesianChart.SeriesProvider>

 

VM .. { ..
public ObservableCollection<Item> Data { get; set; }
 
 Data.Add(new WaveFormItem()
            {
                Name = "105.1",
                LineData = new ObservableCollection<LineDataModel>()
            {
                new WaveFormLineData() { Vector = 0, Value = 1.0 },
                new WaveFormLineData() { Vector = 1, Value = 1.1 }
             }
             });
 
}
 
 public class LineDataModel
    {
        public int Vector { get; set; }
        public double Value { get; set; }
    }
 
    public class Item
    {
        public string Name { get; set; }
        public ObservableCollection<LineDataModel> LineData { get; set; }
    }
Petar Marchev
Telerik team
 answered on 10 Mar 2016
6 answers
560 views

I'm working on a chart that had a bunch of series as bars.    I'm wanting to change one from a bar to a bubble series and when the chart goes to display I get an error in Telerik code with the exception: "Width and Height must be non-negative".

 The stack trace is in the attached PNG file ("Tracker" is my app).

 

Martin Ivanov
Telerik team
 answered on 10 Mar 2016
2 answers
93 views

Hello,

if i bind a DataTable to a RadGridView.ItemsSource and try to search with SearchPanel, i'm getting a System.ArgumentException error.

Column 'xy' does not belong to table xy.

Can you help me please? Thanks.

 

<telerik:RadGridView ItemsSource="{Binding Table}" ShowSearchPanel="True"/>

 

private DataTable _table;
 
public DataTable Table
{
    get { return _table; }
    set
    {
        if (Equals(value, _table)) return;
        _table = value;
        OnPropertyChanged(nameof(Table));
    }
}
 
 
public ViewModel()
{
    Table = new DataTable("Test");
    Table.Columns.Add("Spalte 1");
    Table.Columns.Add("Spalte 2");
    Table.Columns.Add("Spalte 3");
 
    for (var i = 0; i < 50; i++)
    {
        var row = Table.NewRow();
        row.ItemArray = new object[] { "Cell 1 " + i, "Cell 2 " + i, "Cell 3 " + i };
        Table.Rows.Add(row);
    }
}
Philipp
Top achievements
Rank 1
 answered on 10 Mar 2016
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?