I want to create a property in a control that will act as a viewer that will be able to connect to another non-visual control to show its current status. In this example let’s say that the viewer will simply show the status of online or offline.
I want to be able to drop a non-visual control, let’s call it a Heater
of type IHeater
, on the form and then drop a HeaterMonitor
. I want to go into the properties of the HeaterMonitor
and for the custom Source
property see a list of all of the IHeaters
currently on the form.
Selecting an instance (Heater1
) in the Source
property would subscribe HeaterMonitor1
to all the status updates generated by Heater1
.
Is there an existing pattern I can follow as a template?
If it makes a difference I can use .net 3.5 and higher. I selected data-binding
as a tag, but I'm not sure that is correct because this is not a database question. But it does seem similar to a DataGridView
selecting a DataSource
property.
Edit #1:
Based on the comments so far I don't think I emphasized enough what I'm trying to get. I want the property editor to list the eligible IHeater
controls on the form. I don't have an issue with creating a regular IHeater
property that I can assign at run-time.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…