Questions tagged [system.componentmodel]

The System.ComponentModel namespace provides classes that are used to implement the run-time and design-time behavior of components and controls. This namespace includes the base classes and interfaces for implementing attributes and type converters, binding to data sources, and licensing components.

The classes in this namespace divide into the following categories:

114 questions
6
votes
1 answer

Working with System.ComponentModel

I am having a bit of difficulty in understanding how the Container/Component model interacts with each other in C#. I get how the Component contains a Site object which has information about Container and Component. But, suppose I had the following…
Kyle Baran
  • 1,793
  • 2
  • 15
  • 30
5
votes
3 answers

Why is an Azure Function on .NET 6 looking for System.ComponentModel Version 6.0.0.0?

I am deploying an Azure Function called "Bridge" to Azure, targeting .NET 6. The project is referencing a class library called "DBLibrary" that I wrote, and that library is targeting .NET Standard 2.1. The Azure Function can be run locally on my PC…
5
votes
3 answers

Is there a way to automatically create DependencyProperty in MVVM

More of a usability question. I'm building a big MVVM application, and I find myself copying / modifying this piece of code all over the place: public NodeKind Kind { get { return (NodeKind)this.GetValue(KindProperty); } set {…
edeboursetty
  • 5,669
  • 2
  • 40
  • 67
5
votes
2 answers

How to export a type in MEF as if the Export Attribute had been applied to that type?

I would like to dynamically apply the MEF Export attribute to a type at run-time, exactly as if the type had had an Export attribute applied at compile time. Is there a simple way to do this? Barring that, is there a complex way to do this?
Wayne Bloss
  • 5,370
  • 7
  • 50
  • 81
4
votes
2 answers

Properties Window does not display events for 3rd level nested components unless a 2nd level nested component has an event

I have two System.ComponentModel classes, ComponentA and ComponentB: public class ComponentA : Component { [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ComponentB ComponentB { get; } = new ComponentB(); …
4
votes
0 answers

F# script cannot find type in referenced assembly

I'm using Core 3.1 to build a C# WPF MVVM application. I have a base view model class that implements IDataErrorInfo and works fine. This uses a reference to System.ComponentModel. I'm using F# to test the view models and am trying to use an F#…
pilsdumps
  • 495
  • 1
  • 7
  • 23
4
votes
5 answers

Linq expressions and extension methods to get property name

I was looking at this post that describes a simple way to do databinding between POCO properties: Data Binding POCO Properties One of the comments by Bevan included a simple Binder class that can be used to accomplish such data binding. It works…
Flack
  • 5,727
  • 14
  • 69
  • 104
4
votes
2 answers

Is it possible to add custom properties to c# enum object?

Using c# Is it possible using to associate properties for each enum items? I have used the Description Attribute to add English description to an enum item. To add English description to each item I have done the following public enum MyEnum { …
Junior
  • 11,602
  • 27
  • 106
  • 212
4
votes
3 answers

MEF and unit testing with NUnit

A few weeks ago I jumped on the MEF (ComponentModel) bandwagon, and am now using it for a lot of my plugins and also shared libraries. Overall, it's been great aside from the frequent mistakes on my part, which result in frustrating debugging…
Dave
  • 14,618
  • 13
  • 91
  • 145
4
votes
1 answer

Is MarshalByValueComponent still used or useful?

I have been exploring reinventing the DataTable and I am wondering what the uses are for MarshalByValueComponent. I believe it is used for .NET Remoting (maybe WinForms and WebForms), but that was replaced superseded by WCF. I cannot find any…
Dustin Kingen
  • 20,677
  • 7
  • 52
  • 92
3
votes
0 answers

Evaluate custom model attribute in more generic way

I have a data model like below. One of its properties has been decorated with custom attribut - "Mergable": public class Example { [Browsable(false)] [Mergable(false)] public int ExampleId { get; set; } } Here's a definition of…
robs23
  • 135
  • 1
  • 13
3
votes
1 answer

.NET Process.GetProcesses() "Access is denied."

I am trying to get a list of processes running on the current machine using the below code: using System; using System.Data; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using…
Brian
  • 1,951
  • 16
  • 56
  • 101
3
votes
1 answer

Inherited Control Visible/Enabled Property Value Always True: PropertyGrid

I have created a custom WinForms hosting environment. Which has a toolbox and a PropertyGrid. The controls displayed in the Toolbox are inherited from existing WinForm controls. DropDownList Source: public interface IPropertyFilter :…
Zuhaib
  • 1,420
  • 3
  • 18
  • 34
3
votes
1 answer

GetExportedValues returns nothing, I can see the parts

I have a strange MEF problem, I tested this in a test project and it all seems to work pretty well but for some reason not working in the real project This is the exporting code public void RegisterComponents() { …
roundcrisis
  • 17,276
  • 14
  • 60
  • 92
3
votes
2 answers

Declarative conditional validation of a field based on other one from parent model

I have two separate types: public class Person { public string Name { get; set; } public bool IsActive { get; set; } public Contact ContactDetails { get; set; } } public class Contact { [RequiredIfActive] public string Email {…