wpf propertyGrid

前端 未结 4 1870
逝去的感伤
逝去的感伤 2021-01-06 03:39

I need a propertyGrid for my WPF application . after lots of searches I have found this I have added the assembly (exe file) when I add the propertyGrid to my form and I run

相关标签:
4条回答
  • 2021-01-06 03:58

    This is due to a bug in the WPFPropertyGrid code.

    It appears from his ThemeInfoAttribute that the author of that code intended to use a generic theme, but he mistakenly put his resources in the file "Themes/default.xaml" instead of "Themes/generic.xaml". Because of this the resources were not automatically loaded. He worked around the bug by loading the resources manually from his App.xaml.

    When you referenced his .exe from yours, his App.xaml wasn't loaded so his workaround wasn't activated.

    The best solution is to correct the filename in the original code to "Themes/generic.xaml". If that is not possible, the second-best solution is to manually load the resources from your App.xaml:

      <Application.Resources>
    
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/WPGDemo;Component/Themes/Default.xaml" />
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    
      </Application.Resources>
    

    Or if you prefer, you can put this in a tag in your window.

    Note that the above XAML assumes other resources will be used so a merge will be necessary. If not, you can skip the steps of creating a seperate dictionary and merging, and instead just set the WPGDemo dictionary as your App or Window dictionary.

    Have a great day!

    0 讨论(0)
  • 2021-01-06 04:03

    I know this is an old post, but there is a new PropertyGrid on the block and it is the most functional and feature rich one out there. Oh and it's FREE!

    http://wpftoolkit.codeplex.com/

    enter image description here

    0 讨论(0)
  • 2021-01-06 04:13

    Did you read the documentation at the download page?

    WPF Property Grid Download Page

    It seems like you have to reference the property you want edited, like this for example:

    <wpg:PropertyGrid Width="550" Height="550" Instance="{Binding ElementName=button}" />
    <Button x:Name="button" Content="Click" />
    
    0 讨论(0)
  • 2021-01-06 04:14

    For whoever is interested, I've started a simple - but I hope useful - free and open source PropertyGrid project for WPF.

    The source is available here: https://github.com/SoftFluent/SoftFluent.Windows and there is also a nuget package here: https://www.nuget.org/packages/SoftFluent.Windows.

    It has no dependencies, but requires .NET 4 as it uses WPF's .NET 4 DataGrid class.

    0 讨论(0)
提交回复
热议问题