Getting System.Windows.ResourceDictionary Warning

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 3 months ago by rex hui
Version: 19.1.0686
Platform: .NET 4.8
Environment: Windows 10 (64-bit)
Avatar

If I have a PropertyGrid set to use display attributes like this:

<grids:PropertyGrid x:Name="xProp">
   <grids:PropertyGrid.PropertyEditors>
      <gridseditors:EnumPropertyEditor UseDisplayAttributes="True"/>
   </grids:PropertyGrid.PropertyEditors>
</grids:PropertyGrid>
[TypeConverter(typeof(FileDoubleClickAction))]
public enum FileDoubleClickAction
{
   [Description("View/Open")]
   View,
   Transfer,
   None,
}
[Serializable]
public class MyClass
{
   public FileDoubleClickAction DoubleClick { get; set; }
}
  xProp.DataObject = new MyClass();
  ThemeManager.CurrentTheme = "MetroDark";

If I have the theme set to a non default theme, I am getting this warning when the dialog is opened:

System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='PropertyGridPropertyEditorsModifierKey'

Comments (4)

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rex,

I used the code above but am not seeing that happen, at least with the latest codebase in Visual Studio 2019.  Which exact Actipro WPF Controls version and build are you on, and which Visual Studio?  Your original post said 2019.1 build 686.

The latest codebase does look for that key in PropertyGrid.OnApplyTemplate, but uses TryFindResource.  I wouldn't expect that to raise a "Resource not found" warning ordinarily though.  I even tried setting my VS 2019 "Options / Debugger / Output Window / Resource Dictionaries" entry to "All" and didn't see the warning in the VS Output.


Actipro Software Support

Posted 3 months ago by rex hui
Avatar

I have the latest 686 code and I tested with both VS 2017 and 2019 both produce the same warning. I have the Debugging setting for "Resource Dictionaries" set to Warning. I am not sure why you are not able to get that.

Should I send my project in a zip file to support?

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

I'm not sure why I'm not seeing it either.  You should be able to eliminate the warning by putting this in your Application.Resources:

<grids:PropertyGridPropertyEditorsModifier x:Key="{x:Static grids:PropertyGrid.PropertyEditorsModifierKey}" />

The lookup is basically trying to see if any global property editor modifiers have been supplied.  The above code should supply an "empty" modifier, but at least the resource will then be found.


Actipro Software Support

Posted 3 months ago by rex hui
Avatar

Yeah, that fixed it. Thank you!

The latest build of this product (v2020.1.1) was released 15 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.