473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Another PropertyGrid Question

Hello,

I have the property grid control in my WinForm app. I have a property
where I implemented a simple drop-down editor via the TypeConverter.

I was wondering whether it is possible to add items to the dropdown
after the application has initially populated it? For instance,
consider the code below. In it, the ColorThemeManager exposes in the
dropdown the list of files with the .ColorTheme extention. At some
point, the another .ColorTheme file will be added and I want my
PropertyGrid control to reflect that. However, nothing I've done so far
(including resetting the PropertyGrid.SelectedObject has worked. Any
ideas or is this a lost cause?

//form code
ColorThemeManager oCtm = new ColorThemeManager()
this.myPropertyGrid.SelectedObject = oCtm;

//class code
class ColorThemeManager
{
[TypeConverter(typeof(ColorThemeConverter))]
[RefreshPropertiesAttribute(RefreshProperties.Repai nt)]
public string ColorTheme
{
get
{
return m_ColorTheme;
}
set
{
m_ColorTheme = value;
}
}
}
public class ColorThemeConverter: StringConverter
{
private static StandardValuesCollection themeList;

public ColorThemeConverter ()
{
string [] FileList = Directory.GetFiles(Application.StartupPath,
"*.ColorTheme");
themeList = new StandardValuesCollection(FileTitles);
}

public override bool GetStandardValuesSupported(ITypeDescriptorContext
context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext
context)
{
return false;
}
public override StandardValuesCollection
GetStandardValues(ITypeDescriptorContext context)
{
return themeList;
}
}
Nov 16 '05 #1
0 1027

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave Girvitz | last post by:
I have a PropertyGrid (Windows Forms App) based component that uses TypeConverters to generate ranges of acceptable values for properties. The idea was that I could download the key/value pairs...
3
by: Pol Bawin | last post by:
Hi All, One : I have a property that get/set a array of an abstract class A By default my array is null In the propertygrid, It is not works correctly when my array is null. (when my array...
0
by: newbie | last post by:
Hello All, I am trying to develop an application to edit various 'entities' in a database. Entities include User, Group, Department, Test, System, approximately 20 - 30 class. Several classes...
3
by: Frank Rizzo | last post by:
I added a PropertyGrid control to my form and set its SelectedObject property to one of my objects which exposes a lot of properties of type System.Drawing.Color. The System.Drawing.Color display...
1
by: Chris Dunaway | last post by:
Consider the following simple class: Public Class SomeClass Private _AnInteger As Integer Public Property AnInteger As Integer Get Return _AnInteger End Get Set(Value As Integer)
5
by: Ger | last post by:
The propertygrid is a great control, but I would like to show a more descriptive text for the properties in the control. I tried to find a solution within the system.componentmodel but did not...
6
by: Steve Teeples | last post by:
Can someone show me an example of how to place a "CheckedListBox" property within a PropertyGrid? -- ----------- Thanks, Steve
5
by: Lee | last post by:
Hi, Using the propertygrid, is it possible to have a user selectable 'unit of measure' for a field. For example, I am looking at using a propertygrid for defining inputs into a calculation. ...
4
by: phcmi | last post by:
I have a PropertyGrid question. My task is to replace a legacy dialog box presentation with a modern one. The dialog itself allows the user to set configuration settings in our application, so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.