Is it possible to change the layout of the RadDatForm control in the auto-generate layout, such that instead of just having one column of property/value pairs, you can define multiple, or at least two?
I know that I can create any layout by providing custom NewItem/ReadOnly/Edit templates. However, in order to do that, I would need to design specific templates for each DB table I want to work with, and I have many. For now, I would like to work with the auto-generated layout, but be able to better utilize the available screen space (hence the desire for more than one column with the auto-generate layout). With the current format (one property/value pair per row), I sometimes end up with a list of items that needs to be vertically scrolled, while I have lots of horizontal screen width being wasted.
Is this possible without creating custom templates for each edited table?
Hello,
why when i use the EditEnded Event i have not the item in the events args?
All work fine whit AddedItem and DeletedItem Events.
Thank you and Regards.
In one of our WPF applications there is a gridview which seems to randomly throw an exception and then crash the application.
I can't seem to figure out how to prevent the error or even to prevent the crash.
I tried catching unhandled exceptions however that doesn't work.
The stack trace is below:
2017-02-01 12:29:39.1438|ERROR|19608|1|System.Windows.RoutedEventArgs.InvokeEventHandler|Unhandled exception|System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.Parameter name: count at System.Linq.Enumerable.Range(Int32 start, Int32 count) at Telerik.Windows.Controls.GridView.Selection.CellRegionsPartitioner.CalculateAffectedRegions(Pair`2 firstAndLastSelectedIndices, Int32 columnCount) at Telerik.Windows.Controls.GridView.Selection.CompositeSelectionHandler.UpdateSelectedCells(IList`1 items, Boolean isSelected) at Telerik.Windows.Controls.GridView.Selection.CompositeSelectionHandler.UpdateCellSelectionOnSelectedItemsChanged(SelectionChangeEventArgs selectionChangeArgs) at Telerik.Windows.Controls.GridView.Selection.CompositeSelectionHandler.OnOwnerSelectionChangedDispatch(Object sender, SelectionChangeEventArgs e) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.RoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseSelectionChangedEvent(SelectionChangeEventArgs args) at Telerik.Windows.Data.Selection.ItemSelectionHandler.EndAllowedSelection(ItemSelectionChange selectionChange) at Telerik.Windows.Controls.GridView.Selection.CompositeSelectionHandler.PerformRowSelection(Object dataItem, SelectionModificationOptions modificationOptions) at Telerik.Windows.Controls.GridView.Selection.CellAndRowSelectionDispatcher.HandleSelectionForCellInput(GridViewCell cell, SelectionModificationOptions allowedModifications) at Telerik.Windows.Controls.GridView.GridViewDataControl.HandleMouseDownSelection(GridViewCell cell, Boolean allowDrag, Point mousePosition) at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at MyApp.App.Main()
Greetings,
I want to change default color of relations.
Hi,
I have for example following GridView:
<telerik:RadGridView x:Name="gvSystems" Grid.Row="1" Grid.Column="0" DataContext="{Binding}" ItemsSource="{Binding Systems}" AutoGenerateColumns="False"
ShowSearchPanel="False" ShowGroupPanel="False" ShowGroupFooters="False" IsFilteringAllowed="True" FilteringMode="FilterRow" IsReadOnly="True" GroupRenderMode="Flat"
SelectionMode="{Binding QueryFilterModel.MultiSelectSystems, Converter={StaticResource BoolToSelectionModeConverter}}" Margin="3" CanUserSortColumns="True">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn IsSortable="True" Header="{Binding Path=[VXScada_GernericQueries_GridView_ID], Source={x:Static commonUIRes:TextContainer.Instance}}" DataMemberBinding="{Binding SystemID}" />
<telerik:GridViewDataColumn IsSortable="True" Header="{Binding Path=[VXScada_GernericQueries_GridView_Name], Source={x:Static commonUIRes:TextContainer.Instance}}" DataMemberBinding="{Binding SystemName}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
If I click into the header to sort my application crashes with following Exception (This happens with each RadGridView I have):
System.NullReferenceException
Source: Telerik.Windows.Data
StackTrace:
bei Telerik.Windows.Data.QueryableCollectionView.InternalGetItemAt(Int32 index)
bei Telerik.Windows.Data.QueryableCollectionView.GetItemAt(Int32 index)
bei Telerik.Windows.Data.DataItemCollection.get_Item(Int32 index)
bei Telerik.Windows.Controls.GridView.Rows.GetRowItemsAtRange(Int32 startIndex, Int32 endIndex)
bei Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.RealizeRows(Int32 startIndex, Int32 endIndex, Double& verticalOffset, HashSet`1& realizedRows)
bei Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.MeasureOverride(Size availableSize)
bei Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size availableSize)
bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
bei System.Windows.UIElement.Measure(Size availableSize)
bei System.Windows.ContextLayoutManager.UpdateLayout()
bei System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
bei System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
bei System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
bei System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
bei MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Windows.Threading.DispatcherOperation.Invoke()
bei System.Windows.Threading.Dispatcher.ProcessQueue()
bei System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
bei System.Windows.Application.RunDispatcher(Object ignore)
bei System.Windows.Application.RunInternal(Window window)
hi dera all,
i have binded a table to the gridview. now, the grid cell for example double type, errors when the user left it empty and does not let user to go to the other cells. i do not need it.
i need to user to freely go to the different cells and only caugh on the inputting wrong datatype forexample inputting string instead of double (not lefting a double cell empty). how can i disable built in validation for this?
also i need to check the cells manually and under certain circumestances, change the color of dell border to be red and else black. what does you suggest?
best regards.
Hi @ll,
I need your help. After searching the internet for several hours I have
no solution for my problem.
I have an enum property which I bind to a GridViewComboBoxColumn
using the following xaml code:
<telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding Options}" DataMemberBinding="{Binding Position}" DisplayMemberPath="Value" SelectedValueMemberPath="Key"/>
Options is a property which maps the enum value to a string:
public enum Pos{ A, B, C}public class DisplayObject<T>{ private readonly T key; private readonly string val; public DisplayObject(T key, string val) { this.key = key; this.val = val; } public T Key => this.key; public string Value => this.val;}
public IEnumerable<DisplayObject<Pos>> Options{ get { yield return new DisplayObject<Pos>(Pos.A, "HUGO"); yield return new DisplayObject<Pos>(Pos.B, "EGON"); yield return new DisplayObject<Pos>(Pos.C, "WILLI"); }}
Grid works fine. But there are some problems with the FilteringControl.
I want the FilteringControl to uses the DisplayMemberPath to display
the DistinctValues and ComboBox Options.
Can anyone help me solving my problem?
public class Item : INotifyPropertyChanged{ private Pos pos; private string name; public Item(string name, Pos pos) { this.name = name; this.pos = pos; } public string Name { get { return this.name; } } public Pos Position { get { return this.pos; } set { if (this.pos == value) { return; } this.pos = value; this.OnPropertyChanged(nameof(this.Position)); } } public IEnumerable<DisplayObject<Pos>> Options { get { yield return new DisplayObject<Pos>(Pos.A, "HUGO"); yield return new DisplayObject<Pos>(Pos.B, "EGON"); yield return new DisplayObject<Pos>(Pos.C, "WILLI"); } } public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged(string propertyName) { this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }}<Window x:Class="ChangeDefaultFilterOperator.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:my="clr-namespace:ChangeDefaultFilterOperator" Title="MainWindow" Height="700" Width="700"> <Window.Resources> <my:MyViewModel x:Key="MyViewModel"/> </Window.Resources> <Grid DataContext="{StaticResource MyViewModel}"> <telerik:RadGridView ItemsSource="{Binding Items}" AutoGenerateColumns="False" Margin="5"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/> <telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding Options}" DataMemberBinding="{Binding Position}" DisplayMemberPath="Value" SelectedValueMemberPath="Key"/> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid></Window>public class MyViewModel{ private readonly ObservableCollection<Item> items; public MyViewModel() { this.items = new ObservableCollection<Item> { new Item("AAA", Pos.A), new Item("BBB", Pos.B), new Item("CCC", Pos.C) }; } public ObservableCollection<Item> Items { get { return this.items; } }}Hello All,
I am using WPF and MVVM. I have a observable collection of objects that I am displaying in the grid. I am trying to add a new column at the beginning of the gridview that has a button in it . This button needs to fire off a command in my ViewModel. In the command's execute method, I need to edit some of the properties of the entity that that row represents in my observable collection. I am assuming that I'll need to pass some sort of parameter to the command to send in either the row contents or some event args for the button being clicked... But I'm not exactly sure what I need to do. I would interested the most in doing this WITHOUT any code-behind in the View, and do this some way with the XAML and ViewModel code, trying to keep in the MVVM frame of mind... Any help will be greatly appreciated!
Thanks in advance,
Kevin Orcutt
Hello,
I have written a Custom Command Descriptor based on the Telerik demos and documentation that exports the currently loaded document to a local file. Everything appears to be working 100% correct with no errors. However, when I open the file all the pages are blank. The page count is correct, so it appears to be reading the PDFViewer document correctly into the stream, just not writing all of the bytes properly. Here is my code behind for the page that contains the Document Viewer control.
using System;using System.IO;using System.Windows;using System.Windows.Controls;using System.Windows.Input;using Telerik.Windows.Documents.Fixed.FormatProviders;using Telerik.Windows.Documents.Fixed.FormatProviders.Pdf;using Telerik.Windows.Documents.Fixed.Model;using WeldTrackingWPF.ViewModel;using Telerik.Windows.Controls;using Telerik.Windows.Documents.Commands.Descriptors;using Telerik.Windows.Documents.Commands;namespace WeldTrackingWPF.View{ /// <summary> /// Interaction logic for ViewQualificationDoc.xaml /// </summary> public partial class ViewDoc : Page { public ViewDoc(byte[] fileBytes) { InitializeComponent(); /// <summary> /// Read bytes into memory stream /// Pass stream in RadPdfViewer for viewing /// </summary> this.pdfViewer.CommandDescriptors = new CustomCommandDescriptors(this.pdfViewer); Stream stream = new MemoryStream(fileBytes); FormatProviderSettings settings = new FormatProviderSettings(ReadingMode.AllAtOnce); PdfFormatProvider provider = new PdfFormatProvider(stream, settings); RadFixedDocument doc = provider.Import(); this.pdfViewer.Document = doc; IconSources.ChangeIconsSet(IconsSet.Modern); } private void Page_Initialized(object sender, EventArgs e) { var vm = new ViewDocViewModel(); DataContext = vm; } private void PdfViewer_DocumentLoaded(object sender, EventArgs args) { } private void Page_Unloaded(object sender, RoutedEventArgs e) { } private void tbCurrentPage_KeyDown(object sender, KeyEventArgs e) { TextBox textBox = sender as TextBox; if (textBox != null) { if (e.Key == System.Windows.Input.Key.Enter) { textBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); } } } } public class SaveCommand : FixedDocumentViewerCommandBase { public SaveCommand(FixedDocumentViewerBase fixedDocumentViewerBase) : base(fixedDocumentViewerBase) { } public override void Execute(object parameter) { Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog(); dialog.Filter = "PDF files (*.pdf)|*.pdf"; bool? result = dialog.ShowDialog(); if (result.HasValue && result.Value) { using (Stream stream = File.OpenWrite(dialog.FileName)) { PdfFormatProvider provider = new PdfFormatProvider(); provider.Export(this.Viewer.Document, stream); } } } } public class CustomCommandDescriptors : DefaultCommandDescriptors { private readonly CommandDescriptor saveCommandDescriptor; public CommandDescriptor SaveCommandDescriptor { get { return this.saveCommandDescriptor; } } public CustomCommandDescriptors(FixedDocumentViewerBase fixedDocumentViewer) : base(fixedDocumentViewer) { this.saveCommandDescriptor = new CommandDescriptor(new SaveCommand(fixedDocumentViewer)); } }}Any insight as to why these documents are being exported sans page content would be appreciated.
Thanks!

System.Windows.Data Warning: 40 : BindingExpression path error: 'Title' property not found on 'object' ''String' (HashCode=1191344071)'. BindingExpression:Path=Title; DataItem='String' (HashCode=1191344071); target element is 'ContentPresenter' (Name='Content'); target property is 'ResourceKey' (type 'String')