I have a GridView where the ItemsSource is bound to the PagedSource property of a DataPager. The DataPager ItemsSource is bound to an EntityDataSource. The problem is that this is blocking my UI thread. The GridView has a "DataLoadMode" property which can be set to Asynchronous... but the pager doesn't. How would I go about loading the data to the pager asynchronously? I tried doing this in another thread but I keep getting a cross-thread exception even though I use the dispatcher to set the property to which the pager is bound.
<
telerik:RadGridView
x:Name
=
"RadGridView1"
Grid.Row
=
"0"
Margin
=
"5,5,5,0"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
AlternateRowBackground
=
"LightBlue"
AlternationCount
=
"2"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
CanUserFreezeColumns
=
"False"
CanUserInsertRows
=
"False"
DataLoadMode
=
"Asynchronous"
GroupRenderMode
=
"Nested"
IsReadOnly
=
"True"
ItemsSource="{Binding
ElementName
=
DataPager1
,
Path
=
PagedSource
}"
RowIndicatorVisibility
=
"Collapsed"
ShowGroupPanel
=
"False"
telerik:StyleManager.Theme
=
"Summer"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Width
=
"60"
DataMemberBinding
=
"{Binding StoreNumber}"
Header
=
"Store"
ShowDistinctFilters
=
"True"
ShowFieldFilters
=
"False"
TextAlignment
=
"Center"
/>
<
telerik:GridViewDataColumn
Width
=
"80"
DataFormatString
=
"dd-MMM-yyyy"
DataMemberBinding
=
"{Binding ASNDate}"
Header
=
"Ship Date"
ShowDistinctFilters
=
"False"
SortingState
=
"Descending"
TextAlignment
=
"Center"
/>
<
telerik:GridViewDataColumn
Width
=
"Auto"
MinWidth
=
"80"
DataMemberBinding
=
"{Binding PONumber}"
Header
=
"PO"
ShowDistinctFilters
=
"False"
TextAlignment
=
"Center"
/>
<
telerik:GridViewDataColumn
Width
=
"80"
DataFormatString
=
"dd-MMM-yyyy"
DataMemberBinding
=
"{Binding PODate}"
Header
=
"PO Date"
ShowDistinctFilters
=
"False"
TextAlignment
=
"Center"
/>
<
telerik:GridViewDataColumn
Width
=
"Auto"
MinWidth
=
"80"
DataMemberBinding
=
"{Binding InvoiceNumber}"
Header
=
"Invoice"
ShowDistinctFilters
=
"False"
TextAlignment
=
"Center"
/>
<
telerik:GridViewDataColumn
Width
=
"Auto"
DataMemberBinding
=
"{Binding ToteID}"
Header
=
"Tote"
ShowDistinctFilters
=
"True"
TextAlignment
=
"Center"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Width
=
"Auto"
Height
=
"Auto"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
>
<
Hyperlink
Click
=
"OnToteClick"
Tag
=
"{Binding}"
>
<
TextBlock
Width
=
"Auto"
Height
=
"Auto"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Text
=
"{Binding ToteID}"
/>
</
Hyperlink
>
</
TextBlock
>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Width
=
"80"
DataFormatString
=
"dd-MMM-yyyy"
DataMemberBinding
=
"{Binding Closed}"
Header
=
"Completed"
ShowDistinctFilters
=
"False"
/>
<
telerik:GridViewDataColumn
Width
=
"Auto"
DataMemberBinding
=
"{Binding ClosedByName}"
Header
=
"Complete By"
ShowDistinctFilters
=
"True"
ShowFieldFilters
=
"False"
TextAlignment
=
"Center"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
telerik:RadDataPager
x:Name
=
"DataPager1"
Grid.Row
=
"1"
Width="{Binding ActualWidth,
ElementName
=
RadGridView1
}"
Margin
=
"5,0,5,5"
DisplayMode
=
"FirstLastPreviousNextNumeric"
PageSize="{Binding PageSize,
Mode
=
TwoWay
}"
Source
=
"{Binding ShipmentData}"
telerik:StyleManager.Theme
=
"Summer"
/>
public
class
ShipmentsViewModel : ViewModelBase
{
private
readonly
TIMS.Data.TIMSContext ctx =
new
Data.TIMSContext();
public
ShipmentsViewModel()
{
}
#region Properties
private
int
PageSizeValue = 20;
public
int
PageSize
{
get
{
return
PageSizeValue; }
set
{
SetPropertyValue((() => PageSize),
ref
PageSizeValue, value);
}
}
private
QueryableEntityCollectionView<TIMS.Data.Entities.ToteView> ShipmentDataValue;
public
QueryableEntityCollectionView<TIMS.Data.Entities.ToteView> ShipmentData
{
get
{
return
ShipmentDataValue;
}
private
set
{
SetPropertyValue((() => ShipmentData),
ref
ShipmentDataValue, value);
}
}
#endregion
#region Methods
public
override
void
OnNavigatedTo(Uri view,
object
data)
{
try
{
IsBusy =
true
;
System.Threading.ThreadPool.QueueUserWorkItem(
delegate
{
var shipments =
new
QueryableEntityCollectionView<Data.Entities.ToteView>(((IObjectContextAdapter)ctx).ObjectContext,
"ToteViews"
);
if
(App.Store !=
null
)
{
shipments.FilterDescriptors.Add(
new
FilterDescriptor(
"StoreNumber"
, FilterOperator.IsEqualTo, App.Store.Value,
false
));
}
App.Current.Dispatcher.Invoke(
new
Action(
delegate
{
ShipmentDataValue = shipments;
IsBusy =
false
;
}));
});
}
catch
(Exception e)
{
App.Current.Dispatcher.BeginInvoke(
new
Action(
delegate
{
var dlg =
new
ChildWindows.ErrorDialog(
"0012: An unknown error occured."
);
App.LogError(e);
dlg.ShowDialog();
IsBusy =
false
;
}));
}
}
#endregion
#region Commands
#endregion
}
Hello
Can I load some portion of data programmatically? For example:
class
Work {
public
string
WorkTitle {
get
;
set
; } }
var query = generateQueryFor<Work>.OrderBy(w => w.WorkTitle);
var virtualQuery =
new
VirtualQueryableCollectionView(query) { LoadSize = 50 };
virtualQuery.ItemsLoading += (sender1, eventArgs1) =>
{
//
event doesn't firing
};
virtualQuery.ItemsLoaded += (sender2, eventArgs2) =>
{
//event doesn't firing
};
// how force to load some data?
// GetItemAt doesn't loads any data
var row0 = virtualQuery.GetItemAt(0);
var row1 = virtualQuery.GetItemAt(1);
var row2 = virtualQuery.GetItemAt(2);
Hi,
I am using RadMaskedNumericInput control for Percent input. I have decimal datatype property bound to the control. When i try to update value in control as number 55, it updates the background property as "0.55".
<
telerik:RadMaskedNumericInput
x:Name
=
"uxPercentToPay"
Grid.Row
=
"6"
Grid.Column
=
"1"
Margin
=
"2,3"
Width
=
"120"
Style
=
"{StaticResource RadMaskedNumericInputStyle}"
Validation.ErrorTemplate
=
"{x:Null}"
UpdateValueEvent
=
"PropertyChanged"
AutoFillNumberGroupSeparators
=
"False"
MaskedInput:MaskedInputExtensions.Maximum
=
"100"
MaskedInput:MaskedInputExtensions.Minimum
=
"0"
Mask
=
"p2.2"
Placeholder
=
" "
AutoFillZeros
=
"True"
Value
=
"{Binding PercentToPay,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
MaskedInput:MaskedInputExtensions.IsEditorTabStop
=
"True"
/>
Background property:
public decimal PercentToPay
{
get
{
return _percentToPay;
}
set
{
if (_percentToPay == value)
{
return;
}
_percentToPay = value;
RaisePropertyChanged(() => PercentToPay);
}
}
Please let me know, what could be the possible miss out here.
Thanks in Advance,
Sagar
Hey all.
We currently have a data grid which we allow the user to drop a list of files onto (from file explorer, for example). We would like to deny the drop if there are invalid files in the list, but I can't see how to do that with the GridView (the TreeView seems to have a much richer drag/drop implementation).
Could I please have some guidance, as I'm at a bit of a loss.
Thanks.
I am using the TreeListView on an app that is used on a Touch Screen device. I am getting some odd lockups. Is there anything I need to know or consider when using a touch screen computer.
I'm using your Windows8Touch theme and it is a windows 8 OS.
Hi there,
I am experiencing an intermittent InvalidOperationException when attempting to show the backstage of a RadRibbonView for the second or subsequent time.
The cause seems to be that the backstage control has not been properly removed from the BackstageAdorner to which it was originally added.
Unfortunately, all of the functionality is either private or internal so it does not appear as though there is any way I can code around this.
Any suggestions would be greatly appreciated.
Thanks.
Here is the call stack related to the error. (since .txt attachments aren't allowed?)
PresentationFramework.dll!System.Windows.FrameworkElement.ChangeLogicalParent(System.Windows.DependencyObject newParent) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.AddLogicalChild(object child) Unknown
> Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RibbonView.BackstageAdorner.BackstageAdorner(System.Windows.FrameworkElement adornedElement, Telerik.Windows.Controls.RadRibbonBackstage backstage, double topOffset) Line 30 C#
Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RadRibbonView.CreateBackstageAdorner() Line 1419 C#
Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RadRibbonView.ShowBackstage() Line 2536 C#
Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RadRibbonView.ToggleIsBackstageOpen() Line 2655 C#
Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RadRibbonView.OnIsBackstageOpenChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e) Line 1960 C#
WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) Unknown
PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) Unknown
WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) Unknown
WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) Unknown
WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal) Unknown
WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) Unknown
Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RadRibbonView.IsBackstageOpen.set(bool value) Line 667 C#
Telerik.Windows.Controls.RibbonView.dll!Telerik.Windows.Controls.RadRibbonView.AppButtonMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) Line 1258 C#
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args, System.Windows.RoutedEvent newEvent) Unknown
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() Unknown
PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) Unknown
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) Unknown
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
PresentationFramework.dll!System.Windows.Application.Run() Unknown
ocontrol.exe!TracRite.Optimum.App.Main() C#
How do I add tooltip to DataFormDataField. I have tried:
Tooltip = " "
telerik:RadToolTipService.ToolTipContent=" "
but none of them are working on DataFormDataField.
<
telerikGrid:RadGridView
AutoGenerateColumns
=
"False"
Grid.Row
=
"3"
>
<
telerikGrid:RadGridView.Columns
>
<
telerikGrid:GridViewDataColumn
Header
=
"Name"
Width
=
"*"
/>
</
telerikGrid:RadGridView.Columns
>
</
telerikGrid:RadGridView
>
<
ListView
Grid.Row
=
"1"
ItemsSource
=
"{Binding Selections}"
>
<
ListView.ItemTemplate
>
<
DataTemplate
>
<
StackPanel
>
<
DataGrid
AutoGenerateColumns
=
"False"
>
<
DataGrid.Columns
>
<
DataGridTextColumn
Header
=
"name"
Width
=
"*"
/>
</
DataGrid.Columns
>
</
DataGrid
>
<
telerikGrid:RadGridView
AutoGenerateColumns
=
"False"
>
<
telerikGrid:RadGridView.Columns
>
<
telerikGrid:GridViewDataColumn
Header
=
"Name"
Width
=
"*"
/>
</
telerikGrid:RadGridView.Columns
>
</
telerikGrid:RadGridView
>
</
StackPanel
>
</
DataTemplate
>
</
ListView.ItemTemplate
>
</
ListView
>
I have a project where we have an unknown number of series to display and I'd like to make a legend. From the online documentation, it looks like telerik supports all of this, so I must be doing something wrong : the legend just doesn't show up. Could anyone point me to the problem ? Thank you very much.
Out of curiosity, I would also like to know if there's a way to bind to the series properties once they're displayed - e.g. if I had to design a legend by hand, how would I bind to the colours of the series if I don't know them before-hand (because they're dependent on the chosen palette) ?
I've reproduced this in a smaller project, here's my code :
01.
using
System.Collections.Generic;
02.
using
System.Windows;
03.
04.
namespace
telerikTestSandbox
05.
{
06.
public
class
Serie
07.
{
08.
public
Serie(
string
title)
09.
{
10.
Title = title;
11.
Data =
new
List<Point>() {
new
Point(1, 5),
new
Point(2, 15),
new
Point(3, 10) };
12.
}
13.
14.
public
List<Point> Data {
get
;
set
; }
15.
16.
public
string
Title {
get
;
set
; }
17.
}
18.
}
01.
using
System.Collections.Generic;
02.
using
System.Windows;
03.
04.
namespace
telerikTestSandbox
05.
{
06.
/// <summary>
07.
/// Interaction logic for MainWindow.xaml
08.
/// </summary>
09.
public
partial
class
MainWindow : Window
10.
{
11.
public
MainWindow()
12.
{
13.
DataContext =
this
;
14.
15.
Serie serie2 =
new
Serie(
"Test2"
);
16.
serie2.Data =
new
List<Point>() {
new
Point(1, 25),
new
Point(2, 30),
new
Point(3,20)};
17.
ParticipationData.Add(serie2);
18.
Serie serie3 =
new
Serie(
"Test3"
);
19.
serie3.Data =
new
List<Point>() {
new
Point(1, 15),
new
Point(2, 20),
new
Point(3, 25) };
20.
ParticipationData.Add(serie3);
21.
}
22.
23.
public
List<Serie> ParticipationData
24.
{
25.
get
{
return
(List<Serie>)GetValue(ParticipationDataProperty); }
26.
set
{ SetValue(ParticipationDataProperty, value); }
27.
}
28.
29.
// Using a DependencyProperty as the backing store for ParticipationData. This enables animation, styling, binding, etc...
30.
public
static
readonly
DependencyProperty ParticipationDataProperty =
31.
DependencyProperty.Register(
"ParticipationData"
,
typeof
(List<Serie>),
typeof
(MainWindow),
new
PropertyMetadata(
new
List<Serie>() {
new
Serie(
"Test1"
)}));
32.
}
33.
}
01.
<
Window
x:Class
=
"telerikTestSandbox.MainWindow"
03.
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
04.
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
05.
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
06.
xmlns:sys
=
"clr-namespace:System;assembly=mscorlib"
07.
xmlns:local
=
"clr-namespace:telerikTestSandbox"
08.
>
09.
<
Window.Resources
>
10.
<
Style
x:Key
=
"PerformanceVisualisationStyle"
TargetType
=
"telerik:ScatterLineSeries"
BasedOn
=
"{StaticResource ScatterLineSeriesStyle}"
>
11.
<
Setter
Property
=
"PointSize"
Value
=
"3,3"
/>
12.
<
Setter
Property
=
"RenderMode"
Value
=
"Full"
/>
13.
<
Setter
Property
=
"Grid.IsEnabled"
Value
=
"True"
/>
14.
<
Setter
Property
=
"Grid.Visibility"
Value
=
"Visible"
/>
15.
<
Setter
Property
=
"Grid.ShowGridLines"
Value
=
"True"
/>
16.
<
Setter
Property
=
"LegendSettings"
>
17.
<
Setter.Value
>
18.
<
telerik:SeriesLegendSettings
Title
=
"{Binding Title}"
/>
19.
</
Setter.Value
>
20.
</
Setter
>
21.
</
Style
>
22.
</
Window.Resources
>
23.
24.
<
Grid
>
25.
<
Grid.RowDefinitions
>
26.
<
RowDefinition
/>
27.
<
RowDefinition
/>
28.
</
Grid.RowDefinitions
>
29.
<
telerik:RadCartesianChart
Grid.Row
=
"0"
x:Name
=
"Chart"
Palette
=
"Lilac"
Height
=
"250"
Width
=
"500"
>
30.
<
telerik:RadCartesianChart.HorizontalAxis
>
31.
<
telerik:LinearAxis
Title
=
"Position"
/>
32.
</
telerik:RadCartesianChart.HorizontalAxis
>
33.
<
telerik:RadCartesianChart.VerticalAxis
>
34.
<
telerik:LinearAxis
Title
=
"Value"
/>
35.
</
telerik:RadCartesianChart.VerticalAxis
>
36.
<
telerik:RadCartesianChart.SeriesProvider
>
37.
<
telerik:ChartSeriesProvider
Source
=
"{Binding ParticipationData}"
>
38.
<
telerik:ChartSeriesProvider.SeriesDescriptors
>
39.
<
telerik:ScatterSeriesDescriptor
ItemsSourcePath
=
"Data"
XValuePath
=
"X"
YValuePath
=
"Y"
40.
Style
=
"{StaticResource PerformanceVisualisationStyle}"
>
41.
</
telerik:ScatterSeriesDescriptor
>
42.
</
telerik:ChartSeriesProvider.SeriesDescriptors
>
43.
</
telerik:ChartSeriesProvider
>
44.
</
telerik:RadCartesianChart.SeriesProvider
>
45.
46.
<
telerik:RadCartesianChart.Grid
>
47.
<
telerik:CartesianChartGrid
MajorXLinesRenderMode
=
"All"
MajorLinesVisibility
=
"XY"
/>
48.
</
telerik:RadCartesianChart.Grid
>
49.
</
telerik:RadCartesianChart
>
50.
51.
<
telerik:RadLegend
Grid.Row
=
"1"
Background
=
"White"
52.
BorderBrush
=
"Black"
53.
BorderThickness
=
"1"
54.
Items
=
"{Binding LegendItems, ElementName=Chart}"
55.
HorizontalAlignment
=
"Right"
56.
VerticalAlignment
=
"Top"
/>
57.
</
Grid
>
58.
</
Window
>