Telerik Forums
UI for WPF Forum
3 answers
182 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
413 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
113 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
75 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
188 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
241 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
142 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
669 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
126 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
3 answers
174 views
I've got a RadCollectionNavigator with Source bound to an ObservableCollection<int> in the VM and CurrentItem two-way bound to an int in the VM. When I call ObservableCollection<int>.Remove I'm expecting the RadCollectionNavigator to update and change CurrentItem, but this isn't happening. Is this something it can do or do I have to implement an update to the CurrentItem binding myself in the VM?
Yoan
Telerik team
 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
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?