Hi,
I have 2 applications :- a sample application that I use to test xamDataGrid- my real application
In the test application there is no problem...
But in the real application, when I try to scroll I got the following error :
System.InvalidOperationException was unhandled Message="Cannot set OverridesDefaultStyle property in the default Style." Source="PresentationFramework" StackTrace: at System.Windows.StyleHelper.UpdateThemeStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldThemeStyle, Style newThemeStyle, Style& themeStyleCache) at System.Windows.FrameworkElement.OnThemeStyleChanged(DependencyObject d, Object oldValue, Object newValue) at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce) at System.Windows.FrameworkElement.UpdateThemeStyleProperty() at System.Windows.FrameworkElement.OnInitialized(EventArgs e) at System.Windows.FrameworkElement.TryFireInitialized() at System.Windows.FrameworkElement.AddLogicalChild(Object child) at System.Windows.Controls.ContentControl.OnContentChanged(Object oldContent, Object newContent) at System.Windows.Controls.ContentControl.OnContentChanged(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.Controls.ContentControl.set_Content(Object value) at Infragistics.Windows.DataPresenter.GridViewPanel.a.a(Record A_0) at Infragistics.Windows.DataPresenter.GridViewPanel.Infragistics.Windows.Scrolling.IDeferredScrollPanel.OnThumbDragStart(Thumb thumb, Orientation scrollBarOrientation) at Infragistics.Windows.Scrolling.DeferredScrollService.a(Object A_0, DragStartedEventArgs A_1) at System.Windows.Controls.Primitives.DragStartedEventArgs.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(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at System.Windows.Controls.Primitives.Thumb.OnMouseLeftButtonDown(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonDownThunk(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.ReRaiseEventAs(RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseDownThunk(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(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.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.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at ViewOn.App.Main() in D:\temp\ViewOn\ViewOn\obj\Debug\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()
We can notice that the source of error is :
at Infragistics.Windows.DataPresenter.GridViewPanel.a.a(Record A_0) at Infragistics.Windows.DataPresenter.GridViewPanel.Infragistics.Windows.Scrolling.IDeferredScrollPanel.OnThumbDragStart(Thumb thumb, Orientation scrollBarOrientation) at Infragistics.Windows.Scrolling.DeferredScrollService.a(Object A_0, DragStartedEventArgs A_1)
Maybe the error come from my templates or maybe from the xamDataGrid. But I don't know how to debug this without source code !Also, my application is about 200 Mb !!! So it is not easy.
I don't think it is from us. The "Cannot set OverridesDefaultStyle property in the default Style." sounds like you might have defined a FrameworkElement derived class that calls FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata in its static constructor and in your generic.xaml file the default style for this type tries to set the OverridesDefaultStyle property to True.
I have searched our source and it doesn't appear we are doing this.
It is because of my tooltip template ! But why it is a problem ? There is nothing special and OverridesDefaultStyle must be TRUE !
Here is my tooltip template :
<Style x:Key="{x:Type ToolTip}" TargetType="ToolTip"> <!--Setter Property="OverridesDefaultStyle" Value="true"/--> <Setter Property="HasDropShadow" Value="True"/> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ToolTip"> <Border Name="Border" Background="#dd333333" BorderBrush="#ff888888" BorderThickness="1" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> <ContentPresenter Margin="4" HorizontalAlignment="Left" VerticalAlignment="Top" /> </Border> <ControlTemplate.Triggers> <Trigger Property="HasDropShadow" Value="true"> <Setter TargetName="Border" Property="CornerRadius" Value="4"/> <Setter TargetName="Border" Property="SnapsToDevicePixels" Value="true"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
I'm not sure why the framework is throwing the exception. Is this style defined in generic.xaml?
Also, I'm not clear as to why you must set OverridesDefaultStyle to true. If you leave it set to false all that will happen is that any properties that are supplied by the default Tooltip style that are not explicitly specified in your style will get merged in. What is it about the default style for Tooltip that is forcing you to set OverrideDefaultStyle to true?
Thanks Joe,
I have finaly remove this flag in my tooltip template and all is fine now ;-)
Thanks a lot for your help
Regards
This solved the same exact issue I was seeing. I also had a tooltip style defined where OverridesDefaultStyle was set to true. I had an open incident# XDG621 if you want to close it.
Thanks,
Rod Yager