Black.Beard.ComponentModel.Attributes
1.0.5
See the version list below for details.
dotnet add package Black.Beard.ComponentModel.Attributes --version 1.0.5
NuGet\Install-Package Black.Beard.ComponentModel.Attributes -Version 1.0.5
<PackageReference Include="Black.Beard.ComponentModel.Attributes" Version="1.0.5" />
<PackageVersion Include="Black.Beard.ComponentModel.Attributes" Version="1.0.5" />
<PackageReference Include="Black.Beard.ComponentModel.Attributes" />
paket add Black.Beard.ComponentModel.Attributes --version 1.0.5
#r "nuget: Black.Beard.ComponentModel.Attributes, 1.0.5"
#addin nuget:?package=Black.Beard.ComponentModel.Attributes&version=1.0.5
#tool nuget:?package=Black.Beard.ComponentModel.Attributes&version=1.0.5
Black.Beard.ComponentModel
Method helper for resolve types and methods.
How to use
You can use in non-intrusive mode. use the type descriptor.
Register the new TypeDescriptorProvider
GenericTypeDescriptionProvider.Register<ExampleType>();
Create a new instance for the specified type
var instance = (ExampleType)TypeDescriptor.CreateInstance(null, typeof(ExampleType), null, null);
var p = TypeDescriptor.GetProperties(i);
var property = p[nameof(ExampleType.Message)];
property.GetValue(i).Should().Be("3");
Add a virtual property
The part based on PropertyTypeDescriptor is insparated from MatthewKing / DynamicDescriptors
var instanceToBind = new ExampleClass();
var descriptor = DynamicDescriptor.CreateFromInstance(instanceToBind);
descriptor.GetDynamicProperty("PropertyOne") // Get the property using its name.
.SetDisplayName("Property #1")
.SetDescription("The first property")
.SetCategory("Example category");
descriptor.GetDynamicProperty((ExampleClass x) => x.Property2) // Get the property using an expression.
.SetDisplayName("Property #2")
.SetDescription("The second property")
.SetCategory("Example category");
propertyGrid.SelectedObject = descriptor;
Binding to an object instance
We can create a DynamicDescriptor for an object instance:
var instance = new ExampleClass();
var descriptor = DynamicDescriptor.CreateFromInstance(instance);
Binding to a dictionary
We can create a DynamicDescriptor backed by a dictionary. This will act as if the dictionary key/value pairs are properties of a bound object:
var data = new Dictionary<string, object>();
data["Property1"] = "hello";
data["Property2"] = "world";
var descriptor = DynamicDescriptor.CreateFromDictionary(data);
We can also supply type information:
var data = new Dictionary<string, object>();
data["Property1"] = "value";
data["Property2"] = 1;
var types = new Dictionary<string, Type>();
types["Property1"] = typeof(string);
types["Property2"] = typeof(int);
var descriptor = DynamicDescriptor.CreateFromDictionary(data, types);
What can be customized?
DisplayName:
descriptor.GetDynamicProperty("PropertyName").SetDisplayName("Property display name");
This modifies the value returned by the DisplayName property.
Description:
descriptor.GetDynamicProperty("PropertyName").SetDescription("A description of the property");
This modifies the value returned by the Description property.
Category:
descriptor.GetDynamicProperty("PropertyName").SetCategory("Category name");
This modifies the value returned by the Category property.
Converter:
TypeConverter converter = /* your custom type converter */;
descriptor.GetDynamicProperty("PropertyName").SetConverter(converter);
This modifies the value returned by the Converter property.
IsReadOnly:
descriptor.GetDynamicProperty("PropertyName").SetReadOnly(true);
This modifies the value returned by the IsReadOnly property.
Property order:
descriptor.GetDynamicProperty("PropertyOne").SetPropertyOrder(1);
descriptor.GetDynamicProperty("PropertyTwo").SetPropertyOrder(2);
descriptor.GetDynamicProperty("PropertyThree").SetPropertyOrder(3);
This modifies the order in which properties are returned by the GetProperties method.
Installation
Just grab it from NuGet
PM> Install-Package DynamicDescriptors
License and copyright
Copyright Matthew King 2012-2020. Distributed under the MIT License. Refer to license.txt for more information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Black.Beard.ComponentModel.Attributes:
Package | Downloads |
---|---|
Black.Beard.ComponentModel
Package Description |
|
Black.Beard.Configurations.ConfigurationProvider.SqlServer
Package Description |
|
Black.Beard.Web.Server
Provide a service base for just concentrate your services |
|
Black.Beard.Sql
Package Description |
|
Black.Beard.Configurations
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.196 | 331 | 4/14/2025 |
1.0.195 | 223 | 4/14/2025 |
1.0.194 | 220 | 4/14/2025 |
1.0.193 | 213 | 4/14/2025 |
1.0.192 | 217 | 4/14/2025 |
1.0.191 | 222 | 4/14/2025 |
1.0.190 | 184 | 4/10/2025 |
1.0.189 | 187 | 4/10/2025 |
1.0.188 | 188 | 4/10/2025 |
1.0.187 | 130 | 4/5/2025 |
1.0.186 | 188 | 4/3/2025 |
1.0.185 | 204 | 4/3/2025 |
1.0.184 | 191 | 4/3/2025 |
1.0.183 | 199 | 4/2/2025 |
1.0.182 | 183 | 4/2/2025 |
1.0.181 | 177 | 4/2/2025 |
1.0.180 | 189 | 4/2/2025 |
1.0.179 | 238 | 4/1/2025 |
1.0.178 | 160 | 3/29/2025 |
1.0.177 | 132 | 3/29/2025 |
1.0.176 | 489 | 3/26/2025 |
1.0.175 | 485 | 3/26/2025 |
1.0.174 | 495 | 3/26/2025 |
1.0.173 | 493 | 3/26/2025 |
1.0.172 | 199 | 3/13/2025 |
1.0.171 | 192 | 3/12/2025 |
1.0.170 | 199 | 3/12/2025 |
1.0.169 | 207 | 3/10/2025 |
1.0.168 | 211 | 3/10/2025 |
1.0.167 | 204 | 3/10/2025 |
1.0.166 | 209 | 3/9/2025 |
1.0.165 | 287 | 3/6/2025 |
1.0.164 | 238 | 3/6/2025 |
1.0.163 | 247 | 3/6/2025 |
1.0.162 | 146 | 2/26/2025 |
1.0.161 | 133 | 2/26/2025 |
1.0.160 | 137 | 2/25/2025 |
1.0.159 | 121 | 2/25/2025 |
1.0.158 | 131 | 2/22/2025 |
1.0.157 | 135 | 2/21/2025 |
1.0.156 | 143 | 2/21/2025 |
1.0.155 | 139 | 2/20/2025 |
1.0.154 | 122 | 2/20/2025 |
1.0.153 | 133 | 2/20/2025 |
1.0.152 | 140 | 2/20/2025 |
1.0.151 | 133 | 2/19/2025 |
1.0.149 | 138 | 2/17/2025 |
1.0.148 | 142 | 2/15/2025 |
1.0.147 | 149 | 2/15/2025 |
1.0.146 | 268 | 1/22/2025 |
1.0.145 | 138 | 1/15/2025 |
1.0.144 | 119 | 1/15/2025 |
1.0.143 | 112 | 1/15/2025 |
1.0.142 | 104 | 1/15/2025 |
1.0.141 | 115 | 1/13/2025 |
1.0.140 | 111 | 1/13/2025 |
1.0.139 | 125 | 1/13/2025 |
1.0.138 | 130 | 1/9/2025 |
1.0.137 | 123 | 1/9/2025 |
1.0.136 | 138 | 1/7/2025 |
1.0.135 | 140 | 12/22/2024 |
1.0.134 | 131 | 12/22/2024 |
1.0.133 | 131 | 12/22/2024 |
1.0.132 | 133 | 12/22/2024 |
1.0.131 | 167 | 12/21/2024 |
1.0.130 | 129 | 12/21/2024 |
1.0.129 | 139 | 12/20/2024 |
1.0.128 | 131 | 12/20/2024 |
1.0.127 | 131 | 12/20/2024 |
1.0.124 | 200 | 12/7/2024 |
1.0.123 | 259 | 11/17/2024 |
1.0.122 | 146 | 11/17/2024 |
1.0.121 | 148 | 11/17/2024 |
1.0.120 | 150 | 11/17/2024 |
1.0.119 | 155 | 11/17/2024 |
1.0.118 | 154 | 11/17/2024 |
1.0.117 | 445 | 10/28/2024 |
1.0.116 | 235 | 10/18/2024 |
1.0.115 | 127 | 10/16/2024 |
1.0.114 | 161 | 9/10/2024 |
1.0.113 | 170 | 9/10/2024 |
1.0.112 | 166 | 9/10/2024 |
1.0.111 | 168 | 9/10/2024 |
1.0.110 | 161 | 9/3/2024 |
1.0.109 | 160 | 8/28/2024 |
1.0.108 | 163 | 8/27/2024 |
1.0.107 | 180 | 8/13/2024 |
1.0.106 | 149 | 7/17/2024 |
1.0.105 | 153 | 7/6/2024 |
1.0.104 | 155 | 7/6/2024 |
1.0.103 | 162 | 7/6/2024 |
1.0.102 | 151 | 7/5/2024 |
1.0.101 | 163 | 7/5/2024 |
1.0.100 | 163 | 7/3/2024 |
1.0.99 | 162 | 7/3/2024 |
1.0.98 | 176 | 7/3/2024 |
1.0.97 | 152 | 7/3/2024 |
1.0.96 | 170 | 7/2/2024 |
1.0.95 | 199 | 5/5/2024 |
1.0.94 | 192 | 5/4/2024 |
1.0.93 | 141 | 5/3/2024 |
1.0.92 | 159 | 5/3/2024 |
1.0.91 | 299 | 5/2/2024 |
1.0.90 | 167 | 5/1/2024 |
1.0.89 | 185 | 4/24/2024 |
1.0.88 | 168 | 4/24/2024 |
1.0.87 | 176 | 4/24/2024 |
1.0.86 | 203 | 4/22/2024 |
1.0.85 | 172 | 4/22/2024 |
1.0.84 | 174 | 4/21/2024 |
1.0.83 | 177 | 4/21/2024 |
1.0.82 | 169 | 4/21/2024 |
1.0.81 | 167 | 4/21/2024 |
1.0.80 | 178 | 4/21/2024 |
1.0.79 | 176 | 4/18/2024 |
1.0.78 | 154 | 4/18/2024 |
1.0.77 | 172 | 4/18/2024 |
1.0.76 | 161 | 4/18/2024 |
1.0.75 | 171 | 4/15/2024 |
1.0.74 | 184 | 4/14/2024 |
1.0.73 | 177 | 4/14/2024 |
1.0.72 | 173 | 4/14/2024 |
1.0.71 | 167 | 4/14/2024 |
1.0.70 | 187 | 4/13/2024 |
1.0.69 | 164 | 4/13/2024 |
1.0.68 | 181 | 4/13/2024 |
1.0.67 | 160 | 4/13/2024 |
1.0.66 | 161 | 4/13/2024 |
1.0.65 | 178 | 4/13/2024 |
1.0.64 | 177 | 4/12/2024 |
1.0.63 | 160 | 4/12/2024 |
1.0.62 | 162 | 4/11/2024 |
1.0.61 | 168 | 4/10/2024 |
1.0.60 | 180 | 4/8/2024 |
1.0.58 | 266 | 4/6/2024 |
1.0.57 | 1,326 | 3/9/2024 |
1.0.56 | 202 | 3/5/2024 |
1.0.55 | 199 | 3/5/2024 |
1.0.54 | 189 | 3/4/2024 |
1.0.53 | 238 | 3/4/2024 |
1.0.52 | 371 | 3/3/2024 |
1.0.51 | 179 | 3/3/2024 |
1.0.50 | 182 | 3/3/2024 |
1.0.49 | 182 | 3/2/2024 |
1.0.48 | 867 | 2/4/2024 |
1.0.47 | 166 | 1/27/2024 |
1.0.46 | 229 | 1/6/2024 |
1.0.45 | 186 | 1/6/2024 |
1.0.44 | 207 | 1/6/2024 |
1.0.43 | 182 | 1/6/2024 |
1.0.41 | 1,802 | 6/17/2023 |
1.0.40 | 332 | 6/17/2023 |
1.0.37 | 6,682 | 3/19/2022 |
1.0.36 | 4,446 | 3/15/2022 |
1.0.35 | 647 | 3/6/2022 |
1.0.34 | 2,498 | 2/11/2022 |
1.0.33 | 740 | 2/11/2022 |
1.0.32 | 651 | 2/11/2022 |
1.0.30 | 626 | 2/11/2022 |
1.0.29 | 654 | 2/9/2022 |
1.0.28 | 620 | 2/8/2022 |
1.0.27 | 612 | 2/8/2022 |
1.0.26 | 607 | 2/8/2022 |
1.0.25 | 632 | 2/6/2022 |
1.0.24 | 684 | 2/4/2022 |
1.0.23 | 650 | 2/2/2022 |
1.0.22 | 644 | 2/1/2022 |
1.0.21 | 642 | 1/27/2022 |
1.0.20 | 652 | 1/27/2022 |
1.0.19 | 662 | 1/26/2022 |
1.0.18 | 660 | 1/26/2022 |
1.0.17 | 639 | 1/20/2022 |
1.0.16 | 644 | 1/15/2022 |
1.0.15 | 654 | 1/15/2022 |
1.0.14 | 647 | 1/12/2022 |
1.0.13 | 556 | 1/12/2022 |
1.0.12 | 653 | 1/12/2022 |
1.0.9 | 408 | 1/9/2022 |
1.0.8 | 408 | 1/9/2022 |
1.0.7 | 396 | 1/9/2022 |
1.0.6 | 416 | 1/8/2022 |
1.0.5 | 12,424 | 12/19/2021 |
1.0.4 | 428 | 12/19/2021 |
1.0.3 | 469 | 12/19/2021 |