Telerik Forums
UI for WPF Forum
3 answers
195 views
Hi
I added three additional columns to the grid, then bound to my datasource (Nothwinds ado entities)

 Public Sub New()  
        MyBase.New()  
 
        Me.InitializeComponent()  
 
        ' Insert code required on object creation below this point.  
        
        gv1.AutoGenerateColumns = False 
        Dim detailDefinition As GridViewTableDefinition = New GridViewTableDefinition()  
        detailDefinition.Relation = New PropertyRelation("Orders")  
        gv1.TableDefinition.ChildTableDefinitions.Add(detailDefinition)  
 
        Dim gvdc As GridViewDataColumn  
 
        gvdc = New GridViewDataColumn  
        gvdc.HeaderText = "One" 
        gvdc.EditorSettings = New ComboBoxEditorSettings  
        gv1.Columns.Add(gvdc)  
 
        gvdc = New GridViewDataColumn  
        gvdc.HeaderText = "Two" 
        gvdc.EditorSettings = New CheckBoxEditorSettings  
        gv1.Columns.Add(gvdc)  
 
        gvdc = New GridViewDataColumn  
        gvdc.HeaderText = "Three" 
        gvdc.EditorSettings = New DatePickerEditorSettings  
        gv1.Columns.Add(gvdc)  
 
        CustomerList = (From c In _cx.Customers.Include("Orders")).ToList  
        Me.gv1.ItemsSource = CustomerList  
 
        _CurrentCustomer = CustomerList(0)  
    End Sub 
 

clicking on and off column "Three" (DatePickerEditor), after the grid has rendered, causes this exception



System.Reflection.TargetInvocationException was unhandled  
  Message="Exception has been thrown by the target of an invocation." 
  Source="mscorlib" 
  StackTrace:  
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)  
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)  
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)  
       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 System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)  
       at Telerik.Windows.Controls.GridView.GridViewCell.RaiseEventEditEnded() in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Cells\GridViewCell.cs:line 1103  
       at Telerik.Windows.Controls.GridView.GridViewCell.CommitEdit() in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Cells\GridViewCell.cs:line 710  
       at Telerik.Windows.Controls.GridView.GridViewCell.TryCommitEdit() in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Cells\GridViewCell.cs:line 887  
       at Telerik.Windows.Controls.GridView.GridViewCell.HandleLostFocus() in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Cells\GridViewCell.cs:line 875  
       at Telerik.Windows.Controls.GridView.GridViewCell.OnLostFocus(RoutedEventArgs e) in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Cells\GridViewCell.cs:line 640  
       at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)  
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)  
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)  
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)  
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)  
       at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)  
       at System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)  
       at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)  
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)  
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)  
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)  
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)  
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)  
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)  
       at System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)  
       at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget)  
       at System.Windows.FrameworkElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)  
       at System.Windows.Input.KeyboardFocusChangedEventArgs.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 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)  
       at System.Windows.Input.InputManager.ProcessStagingArea()  
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)  
       at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)  
       at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)  
       at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew)  
       at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)  
       at System.Windows.Input.Keyboard.Focus(IInputElement element)  
       at Telerik.Windows.Controls.GridView.GridViewCell.GridViewCell_MouseLeftButtonUp(Object sender, MouseButtonEventArgs e) in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Cells\GridViewCell.cs:line 515  
       at System.Windows.Input.MouseButtonEventArgs.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.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)  
       at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)  
       at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)  
       at System.Windows.Input.MouseButtonEventArgs.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 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)  
       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, Int32 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, Boolean isSingleParameter)  
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)  
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)  
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)  
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)  
       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.Threading.Dispatcher.PushFrame(DispatcherFrame frame)  
       at System.Windows.Threading.Dispatcher.Run()  
       at System.Windows.Application.RunDispatcher(Object ignore)  
       at System.Windows.Application.RunInternal(Window window)  
       at System.Windows.Application.Run(Window window)  
       at System.Windows.Application.Run()  
       at WpfApplication2.App.Main() in C:\Examples\wpfTelerik\WpfApplication2\obj\Debug\App.g.vb:line 62  
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)  
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)  
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()  
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)  
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)  
       at System.Threading.ThreadHelper.ThreadStart()  
  InnerException: System.Reflection.TargetInvocationException  
       Message="Exception has been thrown by the target of an invocation." 
       Source="mscorlib" 
       StackTrace:  
            at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)  
            at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)  
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)  
            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 System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)  
            at Telerik.Windows.Controls.GridView.GridViewRow.HandleValueChangedAfterEdit(RadRoutedEventArgs editEventArgs, RecordsChangeListener changeListener) in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Rows\GridViewRow.cs:line 534  
            at Telerik.Windows.Controls.GridView.GridViewRow.Cell_EditCommitted(Object sender, CellRoutedEventArgs e) in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\Rows\GridViewRow.cs:line 554  
       InnerException: System.ArgumentNullException  
            Message="Value cannot be null.\r\nParameter name: fieldName" 
            Source="Telerik.Windows.Controls.GridView" 
            ParamName="fieldName" 
            StackTrace:  
                 at Telerik.Windows.Controls.GridView.GridViewDataControl.DataError(Object sender, DataErrorEventArgs args) in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\GridViewDataControl.cs:line 929  
            InnerException:   
 


Can you advise?


Thanks


P
Vlad
Telerik team
 answered on 17 Feb 2009
2 answers
95 views
How can i disable reordering of columns. It's work vary slow in my application.
Anton Khramov
Top achievements
Rank 1
 answered on 16 Feb 2009
3 answers
117 views
Hi

If there is an validation error on the editable cell, I set a style, in code, for that cell like so:-
 Private Sub gv1_PreviewValidate(ByVal sender As System.ObjectByVal e As Telerik.Windows.Controls.GridView.Cells.CellValidatingRoutedEventArgs)  
        If e.NewValue = String.Empty Then 
            e.ValidationResult = New Telerik.Windows.Controls.GridView.ValidationResult(FalseNothing)  
            DirectCast(DirectCast(e.OriginalSource, System.Object), Telerik.Windows.Controls.GridView.GridViewCell).Style = Me.FindResource("ContentControlStyleError")  
        Else 
            e.ValidationResult = New Telerik.Windows.Controls.GridView.ValidationResult(TrueNothing)  
            DirectCast(DirectCast(e.OriginalSource, System.Object), Telerik.Windows.Controls.GridView.GridViewCell).Style = Nothing 
        End If 

and the style is

 <Style x:Key="ContentControlStyleError" TargetType="{x:Type telerik:GridViewCell}">  
            <Setter Property="Template">  
                <Setter.Value> 
                    <ControlTemplate TargetType="{x:Type ContentControl}">  
                        <Border Width="110" Height="55" BorderThickness="2,2,2,2" CornerRadius="10,10,10,10" BorderBrush="#FF000000" RenderTransformOrigin="0.5,0.5">  
                            <Border.RenderTransform> 
                                <TransformGroup> 
                                    <ScaleTransform ScaleX="1" ScaleY="1"/>  
                                    <SkewTransform AngleX="0" AngleY="0"/>  
                                    <RotateTransform Angle="17.431"/>  
                                    <TranslateTransform X="0" Y="0"/>  
                                </TransformGroup> 
                            </Border.RenderTransform> 
                            <Border.Background> 
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">  
                                    <GradientStop Color="#FF000000" Offset="0"/>  
                                    <GradientStop Color="#FFDC1D1D" Offset="1"/>  
                                </LinearGradientBrush> 
                            </Border.Background> 
                            <ContentPresenter   
                                        VerticalAlignment="Center"   
                                        HorizontalAlignment="Right"   
                                        Margin="0,0,10,0"   
                                        TextBlock.Foreground="White"  /> 
                        </Border> 
                    </ControlTemplate> 
                </Setter.Value> 
            </Setter> 
        </Style> 
now I know this style is awful, but it is the principle I am after.

When I set this style in code, the entire grid cells are no longer editable, also, if I scroll the grid so the offending cell is out of view, then scroll it back into view, the style has disappeared.

Any thoughts why this is happening?


Thanks

P
Valeri Hristov
Telerik team
 answered on 13 Feb 2009
1 answer
194 views
Hello,

Presntly we are evaluating the RadGridView for the WPF, we are planning to use it in near future. We have some queries regarding the GridView, I will be helpful if you reply the queries with yes/no.

1 Does it provide configurable keyboard
and mouse edit commands.
2
Does it provide Excel-like default keyboard and mouse edit behavior, including F2, Esc (cancel edit on a cell and restore the original value), Double-Esc (cancel edit on the entire row and restore the original values), and Enter.
3 Can the Cell editors displaye without entering edit mode, under a variety of conditions such as a mouse hover over the cell or row, the cell or row becoming current, the row being edited, or always.
4 Automatically selects the appropriate editor control depending on the field data type.
5 Manages “null” and “DbNull” values.
6 Any portion of the grid can be made read-only.
7 Custom grouping in grid and details supported or not. Supports hierarchical, multi-level grouping in all views.

8
Supports UI virtualization, preserving memory and reducing load time, even when grouping.
9 2D and 3D Card View
10 Row margin selects and resizes rows, and displays icons indicating that the row is current, is being edited, is an insertion, or has a validation error
11 Automatically changes a row’s height to fit the contents of the largest cell.
12 Supports error style when Validation throws an exception when trying to leave edit mode.Includes built-in data validation, at the cell or row level.
Wether Error display  integrated with the included views
13 Editor Controls Support:
CheckBox.
AutoSelectTextBox.
DatePicker/Calendar.
ValueRangeTextBox.
NumericTextBox.
MaskedTextBox.
DateTimeTextBox.

IPAddressMaskedTextBox.
PhoneMaskedTextBox (North American format).
Simple CurrencyMaskedTextBox.
ExponentNumericTextBox.
DateTimeTextBox (with ShortDate, ShortTime, ShortDateAndShortTime, and ShortDateAndLongTime formats). 
14 Does it support Data virtualization (sometimes called “virtual mode” or “lazy loading”) vastly improves performance and reduces memory usage, especially when working with large data sources.
15 Can it automatically obtain and synchronizes bound data from any .NET source, including jagged arrays, any object that implements IListSource or IList, and any ADO.NET DataSet, DataTable, DataView, or DataViewManager object.
16 Can it intercept, parse, and modify data being synchronized with the database from the grid
17 Excel export of grid contents, including groups, detail content, and statistical functions (formulas and values), using XMLSS or CSV.

Thanks and Regards
 
Stefan Dobrev
Telerik team
 answered on 12 Feb 2009
3 answers
233 views
I would like to have a grid with a button on each row that when pressed launches another window; the handler will have to know the contents of one of the data fields on the row (the pk) in order to display the new window. Based on the outcome of this process the user may or may not check a checkbox on that row that is not bound to data. There will be a button on the window outside of the grid that when pressed will run another process on all rows that have the checkboxes checked. I would also like to have buttons external to the grid that will check or uncheck all of the checkboxes. I have searched the examples and documentation and cannot find out how to determine the PK of the row when the button is pressed nor a way to iterate through the rows and process the ones with the checkbox checked. Some sample code would be appreciated as I'm new to WPF.
Stefan Dobrev
Telerik team
 answered on 12 Feb 2009
3 answers
145 views
Hi,

I've got a little question.

When i've got a lot of rows in my grid and i want to do scrolling using the scrollbar my cpu usage jumps to 80% or more until i stop scrolling!

Same happens with the fade effect when i hover over rows, then my cpu jumps to 60% or more until is stop hovering.

Do you have any explication or solution for this?

Valeri Hristov
Telerik team
 answered on 12 Feb 2009
2 answers
230 views
Hello,

I am having trouble enabling drag/drop functionality in a RadTreeView when I set its ItemsSource to a ListCollectionView. Here is an example:

<Window x:Class="WpfApplication6.Window1" 
    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" 
    SizeToContent="WidthAndHeight" 
    Title="Window1"
    <Telerik:RadTreeView x:Name="sourceTree" Height="300" Width="300" IsDragDropEnabled="True"/> 
</Window> 

    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
 
            ObservableCollection<string> testCollection = new ObservableCollection<string>(); 
            testCollection.Add("one"); 
            testCollection.Add("two"); 
            testCollection.Add("three"); 
 
            ListCollectionView view = new ListCollectionView(testCollection); 
            sourceTree.ItemsSource = view; 
        } 
    } 

The items display fine, but when I drag and drop them nothing seems to happen. If I set the ItemsSource directly to the testCollection, it works just fine, but I need to use a ListCollectionView in my case in order to enable filtering. Is this a bug in the control, or am I doing something improperly? Thanks.

Martin
Top achievements
Rank 1
 answered on 11 Feb 2009
1 answer
133 views
Hello,

I believe I may have discovered a bug with the mousewheel scroll on RadNumericUpDown controls inside of a RadGridView. Here is some example code:

<Window x:Class="RadGridViewBug.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:t="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window1" Height="300" Width="300"
  <StackPanel> 
    <t:RadGridView x:Name="grid" Height="300"/> 
  </StackPanel> 
</Window> 

    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
            TestRow[] rows = new TestRow[2]; 
            rows[0] = new TestRow(); 
            rows[1] = new TestRow(); 
            grid.ItemsSource = rows; 
        } 
    } 
 
    class TestRow 
    { 
        public RadNumericUpDown updown1 { getset; } 
        public RadNumericUpDown updown2 { getset; } 
 
        public TestRow() 
        { 
            updown1 = new RadNumericUpDown(); 
            updown2 = new RadNumericUpDown(); 
        } 
    } 

When I run that code, if I press up or down on a couple of the RadNumericUpDown controls and then use the mousewheel to scroll them, the values of them all change instead of just the last one I clicked on. I would expect only the last one I clicked on to change while scrolling the middle mouse wheel. Thanks in advance for your response!


Valeri Hristov
Telerik team
 answered on 11 Feb 2009
2 answers
128 views
Hi,
I get the following exception when I mark IsHierarchyRoot as "False".

   at Telerik.Windows.Controls.GridView.GridViewItemsControl.ExpandToAvailableSpace() in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\GridViewItemsControl.cs:line 1329 
   at Telerik.Windows.Controls.GridView.GridViewItemsControl.GridViewItemsControl_Loaded(Object sender, RoutedEventArgs e) in r:\WPF_Scrum\WPF_Team\Sources\Development\WPF\GridView\GridView\GridViewItemsControl.cs:line 852 
   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.RaiseEvent(RoutedEventArgs e) 
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent) 
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root) 
   at MS.Internal.LoadedOrUnloadedOperation.DoWork() 
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() 
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() 
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) 
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) 
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
   at System.Threading.ExecutionContext.runTryCode(Object userData) 
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) 
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Windows.Threading.DispatcherOperation.Invoke() 
   at System.Windows.Threading.Dispatcher.ProcessQueue() 
   at System.Windows.Threading.Dispatcher.WndProcHook(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, Boolean isSingleParameter) 
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) 
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) 
   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.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
   at System.Windows.Threading.Dispatcher.Run() 
   at System.Windows.Application.RunDispatcher(Object ignore) 
   at System.Windows.Application.RunInternal(Window window) 
   at System.Windows.Application.Run(Window window) 
   at System.Windows.Application.Run() 
   at Imis.Kinetik.TeamPlayer.Client.App.Main() in C:\Projects\TeamPlayerClient\TeamPlayer.Client\obj\Development\App.g.cs:line 0 
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) 
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Threading.ThreadHelper.ThreadStart() 

My define the grid like this (Info.Fields is a list):

<Telerik:RadGridView  MinHeight="200"   IsHierarchyRoot="False"  ShowGroupPanel="False" Grid.Row="7" Grid.ColumnSpan="2" Margin="5" AutoGenerateColumns="False" ItemsSource="{Binding Path=Info.Fields, ElementName=workunitNodeUC}" > 
            <Telerik:RadGridView.Columns> 
                <Telerik:GridViewDataColumn AutofitWidth="0" UniqueName="{x:Null}"
                    <Telerik:GridViewDataColumn.CellStyle> 
                        <Style TargetType="{x:Type Telerik:GridViewCell}"
                            <Setter Property="Template"
                                <Setter.Value> 
                                    <ControlTemplate  TargetType="{x:Type Telerik:GridViewCell}"
                                        <CheckBox x:Name="chbChosen" HorizontalAlignment="Center"/> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                        </Style> 
                    </Telerik:GridViewDataColumn.CellStyle> 
                </Telerik:GridViewDataColumn> 
                <Telerik:GridViewDataColumn AutofitWidth="0" HeaderText="Description" UniqueName="Description" DataMemberPath="Name" /> 
                <Telerik:GridViewDataColumn AutofitWidth="0" HeaderText="Comment" UniqueName="Comment" DataMemberPath="InnerValue"  /> 
            </Telerik:RadGridView.Columns> 
        </Telerik:RadGridView> 

Thanks
Tal
Top achievements
Rank 1
 answered on 11 Feb 2009
1 answer
313 views
Hello guys,

I have two questions:
  1. How can I bind a gridview from an Anonymous Type returned LINQ query?
  2. How can I get the key value from a grid bound from an Anonymous Type? On ASP.Net Ajax we use GetDataKeyValue method. Do you have a similar on WPF?

Regards,

Henrique
Hristo Deshev
Telerik team
 answered on 11 Feb 2009
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
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
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?