This question is locked. New answers and comments are not allowed.
Greetings,
We just made the switch from SL2 to SL3 and have upgraded to the latest Telerik controls. I have encountered what appears to be a breaking change and I am hoping you can provide some information on how to resolve it.
While we were using SL2, I followed a previous post (http://www.telerik.com/community/forums/silverlight/gridview/costum-edit-template.aspx) to create some custom combo box controls for the gridView. Everything worked great in SL2. After the upgrade, I started getting an exception. None of the code on our end has changed.
Specifically, I have a class named ESCGridViewComboBox that extends GridViewCellEditor:
Note that ESCComboBox simply extends the RadComboBox, but I don't think it is part of the problem.
The problem comes when I try to set the DefaultStyleKey. I was hoping to define the default style for the ESCGridViewComboBox inside Themes/Generic.xaml which is in the same assembly.
Here is the relevant section out of my Generic.xaml:
Pretty straight forward, right?
Again, all this worked fine with the SL2 and the Q2.2009 Telerik controls for SL2.
In SL3, when I use the control inside a grid view, it loads up fine, but when I enter edit mode, and the control's constructor is called, I get an unhanded exception:
A ResourceDictionary '/Telerik.Windows.Themes.Office_Blue;component/Themes/ESC.Shared.UI.Silverlight.Controls.xaml'
cannot be found. Please make sure that references to the needed theme assemblies have been added to the project.
Here is the stack trace:
at Telerik.Windows.Controls.Theme.GetResourceDictionary(Uri uri)
at Telerik.Windows.Controls.Theme.GetResourceFromTheme(Theme theme, String controlAssembly, String defaultStyleKeyFullName, Theme controlTheme)
at Telerik.Windows.Controls.Theme.GetResourceValue(Type defaultStyleKey, Theme theme, Theme controlTheme)
at Telerik.Windows.Controls.Theme.Apply(FrameworkElement element, Theme oldTheme)
at Telerik.Windows.Controls.StyleManager.OnThemeChanged(DependencyObject target, DependencyPropertyChangedEventArgs changedEventArgs)
at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Telerik.Windows.Controls.StyleManager.SetTheme(DependencyObject element, Theme value)
at Telerik.Windows.Controls.StyleManager.SetThemeFromParent(DependencyObject element, DependencyObject parent)
at Telerik.Windows.Controls.GridView.GridViewCell.CreateCellEditor()
at Telerik.Windows.Controls.GridView.GridViewCell.ToggleEditor()
at Telerik.Windows.Controls.GridView.EditContext.OnCellEditModeChanged(GridViewCell cell, Boolean newIsInEditMode)
at Telerik.Windows.Controls.GridView.GridViewCell.IsInEditModeChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Telerik.Windows.Controls.GridView.GridViewCell.set_IsInEditMode(Boolean value)
at Telerik.Windows.Controls.GridView.EditContext.SwitchCellToEditMode(GridViewCell cell)
at Telerik.Windows.Controls.GridView.EditContext.BeginEdit(GridViewCell gridViewCell)
at Telerik.Windows.Controls.GridView.EditContext.OnCellMouseDown(GridViewCell cell)
at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
I am not sure why it's not simply picking up the default style from generic.xaml. Perhaps it's this call to SetThemeFromParent? Has something changed? Am I missing something? Is there a simple fix or work-around?
As always, thanks for your assistance.
We just made the switch from SL2 to SL3 and have upgraded to the latest Telerik controls. I have encountered what appears to be a breaking change and I am hoping you can provide some information on how to resolve it.
While we were using SL2, I followed a previous post (http://www.telerik.com/community/forums/silverlight/gridview/costum-edit-template.aspx) to create some custom combo box controls for the gridView. Everything worked great in SL2. After the upgrade, I started getting an exception. None of the code on our end has changed.
Specifically, I have a class named ESCGridViewComboBox that extends GridViewCellEditor:
| [TemplatePart(Name = "PART_EditorControl", Type = typeof(ESCComboBox))] |
| public class ESCGridViewComboBox : GridViewCellEditor |
| { |
| /// <summary> |
| /// Initializes a new instance of the ESCGridViewComboBox class. |
| /// </summary> |
| public ESCGridViewComboBox() |
| { |
| this.DefaultStyleKey = typeof(ESCGridViewComboBox); |
| this.Loaded += new RoutedEventHandler(ESCGridViewComboBox_Loaded); |
| } //other code... } |
Note that ESCComboBox simply extends the RadComboBox, but I don't think it is part of the problem.
The problem comes when I try to set the DefaultStyleKey. I was hoping to define the default style for the ESCGridViewComboBox inside Themes/Generic.xaml which is in the same assembly.
Here is the relevant section out of my Generic.xaml:
| <ResourceDictionary |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:ESC_Shared_UI_Silverlight_Controls="clr-namespace:ESC.Shared.UI.Silverlight.Controls;assembly=ESC.Shared.UI.Silverlight.Controls"> |
| <Setter.Value> |
| <ControlTemplate TargetType="ESC_Shared_UI_Silverlight_Controls:ESCGridViewComboBox"> |
| <ESC_Shared_UI_Silverlight_Controls:ESCComboBox Name="PART_EditorControl" /> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| </Style> |
| </ResourceDictionary> |
Pretty straight forward, right?
Again, all this worked fine with the SL2 and the Q2.2009 Telerik controls for SL2.
In SL3, when I use the control inside a grid view, it loads up fine, but when I enter edit mode, and the control's constructor is called, I get an unhanded exception:
A ResourceDictionary '/Telerik.Windows.Themes.Office_Blue;component/Themes/ESC.Shared.UI.Silverlight.Controls.xaml'
cannot be found. Please make sure that references to the needed theme assemblies have been added to the project.
Here is the stack trace:
at Telerik.Windows.Controls.Theme.GetResourceDictionary(Uri uri)
at Telerik.Windows.Controls.Theme.GetResourceFromTheme(Theme theme, String controlAssembly, String defaultStyleKeyFullName, Theme controlTheme)
at Telerik.Windows.Controls.Theme.GetResourceValue(Type defaultStyleKey, Theme theme, Theme controlTheme)
at Telerik.Windows.Controls.Theme.Apply(FrameworkElement element, Theme oldTheme)
at Telerik.Windows.Controls.StyleManager.OnThemeChanged(DependencyObject target, DependencyPropertyChangedEventArgs changedEventArgs)
at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Telerik.Windows.Controls.StyleManager.SetTheme(DependencyObject element, Theme value)
at Telerik.Windows.Controls.StyleManager.SetThemeFromParent(DependencyObject element, DependencyObject parent)
at Telerik.Windows.Controls.GridView.GridViewCell.CreateCellEditor()
at Telerik.Windows.Controls.GridView.GridViewCell.ToggleEditor()
at Telerik.Windows.Controls.GridView.EditContext.OnCellEditModeChanged(GridViewCell cell, Boolean newIsInEditMode)
at Telerik.Windows.Controls.GridView.GridViewCell.IsInEditModeChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Telerik.Windows.Controls.GridView.GridViewCell.set_IsInEditMode(Boolean value)
at Telerik.Windows.Controls.GridView.EditContext.SwitchCellToEditMode(GridViewCell cell)
at Telerik.Windows.Controls.GridView.EditContext.BeginEdit(GridViewCell gridViewCell)
at Telerik.Windows.Controls.GridView.EditContext.OnCellMouseDown(GridViewCell cell)
at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
I am not sure why it's not simply picking up the default style from generic.xaml. Perhaps it's this call to SetThemeFromParent? Has something changed? Am I missing something? Is there a simple fix or work-around?
As always, thanks for your assistance.