Hi! I use RadGridView in one of the views of my WPF MVVM Prism 6 application. The view was created on the base of Prism UserControl (WPF). The
solution of my application was created as empty Telerik project. After I had created the solution I added here RadWindow as Shell and also Prism 6
library for WPF via NuGet. I want to map RadGridView.AddingNewDataItem event to a command in viewmodel but unfortunately I can't. Below is RadGridView' XAML snippet from view' markup:
<telerik:RadGridView Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" Margin="8,5,0,0" VerticalAlignment="Top" AutoGenerateColumns="False"
IsReadOnly="True" ItemsSource="{Binding DeviceRecords}" SelectedItem="{Binding SelectedDevice}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding DeviceName}" Header="Name"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding SerialNumber}" Header="Serial Number"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding MountingLocation}" Header="Mounting place"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding CompanyOwnerOfDevice}" Header="Device' owner"/>
</telerik:RadGridView.Columns>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding
Command="{Binding HandleAddingNewRecordToDevicesGridCommand}"
EventName="AddingNewDataItem"
PassEventArgsToCommand="True"/>
</telerik:EventToCommandBehavior.EventBindings>
</telerik:RadGridView>
Below is HandleAddingNewRecordToDevicesGridCommand command that is in viewmodel:
public DelegateCommand<object> HandleAddingNewRecordToDevicesGridCommand { get; private set; }
private void handleAddingNewRecordToDevicesGrid(object parameter)
{
// Get RadGridView that is sender.
Telerik.Windows.Controls.RadGridView gridView =
((parameter as GridViewAddingNewEventArgs).OwnerGridViewItemsControl) as Telerik.Windows.Controls.RadGridView;
// Get new item inserted in the RadGridView.
Telerik.Windows.Controls.GridViewDataColumn newItem =
((parameter as GridViewAddingNewEventArgs).NewObject) as Telerik.Windows.Controls.GridViewDataColumn;
// Prepair to select this new item in the RadGridView.
Telerik.Windows.Controls.GridViewDataColumn[] aItem = { newItem };
System.Collections.IEnumerable selectedItem = aItem;
// Select the new item in the RadGridView.
gridView.Select(selectedItem);
}
this.HandleAddingNewRecordToDevicesGridCommand = new DelegateCommand<object>(this.handleAddingNewRecordToDevicesGrid); // (in viewmodel constructor)
I'm in need of abovementioned code for selecting new inserted row in the RadGridView. So after new row has been inserted into RadGridView then this row is selected in the RadGridView. But HandleAddingNewRecordToDevicesGridCommand command doesn't fire at all! Why? Please help me.
My chart having logic which switching between Point and Line series at run time.Issue is after switching series chart not retain the selection with new series selected.
Please help to resolve this issue.
I can not understand how to solve the following problem: There is real-time chart of Security.
<
<
telerik:RadCartesianChart
x:Name
=
"chart"
Grid.Column
=
"0"
>
<
telerik:RadCartesianChart.Grid
>
<
telerik:CartesianChartGrid
MajorLinesVisibility
=
"Y"
/>
</
telerik:RadCartesianChart.Grid
>
<
telerik:RadCartesianChart.Behaviors
>
<
telerik:ChartCrosshairBehavior
/>
<
telerik:ChartPanAndZoomBehavior
DragToZoomThreshold
=
"0"
MouseWheelMode
=
"Zoom"
DragMode
=
"Pan"
ZoomMode
=
"Both"
PanMode
=
"Both"
/>
</
telerik:RadCartesianChart.Behaviors
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:DateTimeContinuousAxis
x:Name
=
"AxisX"
LabelFormat
=
"HH:mm"
LabelFitMode
=
"Rotate"
SmartLabelsMode
=
"SmartStep"
PlotMode
=
"OnTicksPadded"
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
MajorStep
=
"1"
LineThickness
=
"1"
SmartLabelsMode
=
"SmartStepAndRange"
/>
</
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:CandlestickSeries
ItemsSource
=
"{Binding Candls}"
CategoryBinding
=
"Time"
CloseBinding
=
"Close"
HighBinding
=
"High"
LowBinding
=
"Low"
OpenBinding
=
"Open"
DefaultVisualStyle
=
"{DynamicResource #CandleStickStyle}"
/>
</
telerik:RadCartesianChart
>
public
ObservableCollectionEx<Candle> Candls =
new
ObservableCollectionEx<Candle>();
New candles appear immediately. Change the "Close" is not displayed in the candle when changes occur between the extreme values of the "Close". in a stream of data received and the change correctly. This can be seen on the grid.
I tried to delete data from the collection of the last candle and insert new data, not to make changes to existing ones. The result remained the same :(
How can I display all the changes in the closing candle?
Hi All,
i am using the radgridview control, added the custom filters to it successfully and all the default styles are working great. i have a requirement of infinite scrollbar and display row number on thumb. so i implemented the Data Virtualization but that did not match my requirement, in this the VirtualItemCount has to be set initially(when i tried to set it dynamically all rows data is empty no data is visible in the grid) more over the VirtualQueryableCollectionView maintains its own collection and its like a copy which i don't want. so with the MVVM pattern via observablecollection iam populating the data into the grid and this collection has constant size. now while scrolling when i reach to end of the scroll in the scrollchanged event iam replacing the collection with new data. all this is working but w.r.t this i also need to change the scrollbar's thumb as like inifinite scroll. i had written code to adjust the scrollbar thumb position, length nothing is working. Another issue is like displaying the record number on the thumb i had added the xaml code in style but when i apply the style the gridview is gone, it is not displayed. not sure what is the correct way of displaying the data on the thumb without losing the all default radgridview style.
Anyone please guide me.
Hi,
I wonder if it is possible to have different distances between ticks when using Linear or Categorical axes.
I have attached an image to show what I would like to accomplish.
Thanks,
Alberto
Hi,
I'm trying to change the controlpanelitem RadDropdownButton into a RadButton. So far any luck. Does anybody know how this can be done?
Thanks in advance!