Hello,
Is it possible to change all the XamDataGrid cells height dynamically in procedural code? If so, how could I do it?
Thanks.
Hi ,
I just wanted to know if you were able to solve your issue with the cell height based on Alex's suggestions or you still need help? Just let me know.
Thank you.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
I developed a CellHeight dependency property for a user control and used the below code to set the cell height:
Private Sub GridInfragistics_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
If CellHeight > 0 Then
grdTable.FieldSettings.Height = New FieldLength(CellHeight)
End If
End Sub
It seemed to be working in code. But the actural window which calls the user control threw object null exception for line 'grdTable.FieldSettings.Height = New FieldLength(CellHeight)' in the designer.
I am working on something esle at the moment. If I need more help about this in the future, I will let you know. In the meantime, if you can think what might cause the problem, please let me know.
Hello Huanhe,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
If this is what you were looking for please verify the answer so it helps other users as well.
Sincerely,Petar MonovDeveloper Support EngineerInfragistics Bulgariawww.infragistics.com/support
Hello Patar,
Thanks for your reply. I still got a window designer problem as I said in my previous post . Please see the details below:
'GridInfragistics is a user controlPrivate Sub GridInfragistics_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded If CellHeight > 0 Then grdTable.FieldSettings.CellHeight = CellHeight 'CellHeight is a dependency property End If End Sub
Here are the errors I got in a desinger window when I when I tried to load the user control in a window:
System.NullReferenceExceptionObject reference not set to an instance of an object. at UserControlsSpecific.GridInfragistics.GridInfragistics_Loaded(Object sender, RoutedEventArgs e) in C:\UserControlsSpecific\GridInfragistics.xaml.vb:line 35 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, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
This error didn't affect the runtime performance. It maybe some thing wrong with my other parts of code. But if you could provide a working example by wrapping an xamDataGrid in a user control with a dependency property and load that user control in another window, it will be great.
Hi Huanhe,
I am just checking on your progress and whether you still require assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support