C# - Add A Service To The Type Descriptor Context Of A Property Grid In .Net?

Apr 13, 2010

I have an app that allows the user to choose an image, at design time, either as a straight image, or from an image list.

All cool so far, except that this is not happening from the visual studio property browser, its happening from a property grid that is a part of a type editor.

My problem is, both the image picker (actually resource picker), and the imagelist type converter rely on some design-time services to get the job done. In the case of imagelist, its the IReferenceService and in the case of the resource picker its a service called _DTE.

In the first instance of an edit from the visual studio property browser, I could get a reference to these services but (1) how can I add them to the type descriptor context of my property grid?

It would be better, for future proofing, if I could just copy a reference to all of the services in the type descriptor context. (2) Where does the property browser get these services from in the first place?

ETA: I still don't know how to do it, but I now know it is possible.

(1) Sub-class control and add a property whose type is an array of buttons.

(2) Add it to a form.

(3) Select the new control on the design service and edit the new property in the property browser.

(4) The collection editor dialog pops-up

(5) Add a button

(6) Edit image and image list - the type editor and type converter, respectively, behave as they should.

ETA2: Ok, I'm getting warm. It looks like you do it through the Site property of the property grid. I can create a new site, and pass it the type descriptor context I have a reference to and then it should have all the service. I'll give it a go ...

View 1 Replies


ADVERTISEMENT

Use Property Grid In A Form To Edit Any Type?

Jul 22, 2009

I have an App where I'd like to be able to edit any type (font, colour, point etc.) at run time and use any of the .Net default type editors. (e.g., font/ colour picker).

Rather than re-invent the wheel, I decided to use the property grid control.

If I pass an object of, say font, to the grid, it lists all the fields separately, with no option to open the font picker.[code]...

View 1 Replies

Net Property Grid. Is There A Way To Let The Grid Manipulate Object In Different Way

May 31, 2009

As I understood , The property grid is given an object which it can manipulate by extracting its Properties using reflections.

My problem is that I have a set of Parameters that is determined during run-time , thus I can't staticly compose a class with properties to represent this set.

I have two idea in mind to solve this problem but both are complex and will probably consume lot of time , infact i will say they are not practical under my time constraints. One is to use Reflection Emit in order to define a class dynamically and the other is to dynamiclly build a C# source file and then compile it using CodeDom.

Can Property grid behave in a different manner( other then extracting the Properties of an object using reflections ) that can suite my problem?

I want to say that the reason I went to the property grid from the begining was its ability to provide realy nice Data Retrieval UI for common types.For color you autometically get a palette , For dataTime you automatically have a nice calender. I would like to get those things automatically If possible.

View 1 Replies

Create A Context Menu That Will Only Appear Over A Grid

Dec 21, 2010

I am trying to create a context menu that will only appear over a grid but I am having difficulty. Below is what I've tried ( was also declared at the form level but did not make a difference):

[Code]...

View 3 Replies

VS 2008 - Property Grid - Click On Item Show Its Property

Mar 18, 2009

I have a listbox with several list items added. I want that as user click on an item, I should be able to show its property. This should change for different items. For example (hypothetical) : Listbox has numbers 1 - 10. Now when I select 1 I should be able to set property - Name, Lastname, Colour, Age.

When I select 2 I should be able to set - Age, Hair Colour (clr shows), Weight, Date. When I select 3 then - City (combo box drop down), Country, Age only. This way value changes for diff items. One way is to put them in property grid and show them. Though this looks nice but adding/removing items in that is not easy. You need to have a class that refer that to prop grid. Do I have to code for each classes for all values in listbox or is there an easier way to manage items in property grid. If you think prop grid is not the right tool for such an activity then can you suggest something else.

View 13 Replies

IDE :: Make A Property In A Property Grid A List Box In 2010?

Feb 21, 2011

I have the following property in a property grid in VB.Net 2010.

<Description("Rapid Entry Post Car Wash Settings CarWashOptionPushButtons"), _
Category("Post Car Wash")> _
Public Property CarWashOptionPushButtons() As String

[code]....

I need to make this property a list box that gets the values from a database table and populates the list box with the values from the table. I have tried numerous things to no avail.

View 4 Replies

Property Grid - Open A Dialog Box To Edit A Property?

Oct 29, 2009

Property Grid - Open a dialog box to edit a property?

View 1 Replies

Context Menu Strip Not Appearing On Data Grid View?

Oct 10, 2011

I've done this many time before, but for some reason I can't get it to work this time.I'm trying to get a ContextMenuStrip associated with a DataGridView. I've defined each to the form and in the properties of the DataGridView I've set the ContextMenuStrip property equal to my ContextMenuStrip name (cmsDictionary), defined the onClick event code, but when I run nothing happens.

The program was originally code with a dynamically added context menu but it was popping up all over the place and I wanted to remove that and just let the grid manage it.

View 2 Replies

What Is The Data Context Property

Aug 12, 2010

I was reading the MSDN manual, I was reading about the about the binding.source property. I got a little confused because the manual started taling about the data context property. My question is what is the data context property ? Whenever I look through the properties of an object ( either textbox, datagrid etc ) I can't see this property listed anywhere.Could it be that the version of visual basic that I'm using ( which is Vb 2008 express ) doesn't include this property.

View 2 Replies

Unable To Start Process Under Different User Context From Windows Service?

Nov 24, 2010

I have a Windows Service that needs to start other processes under a user context other than that used by the service. I've seen other posts related to this but have seen no resolutionI've tried many things and have been unsuccessful in starting the process from a Windows Service when a username, password is supplied. orking as it's a requirement of our system to do this and it worked fine until recently and only fails on Vista and Windows 7 (works on XP).

The following code is used to start the process.
Dim P As New Process
P.StartInfo.Domain = Domain

[code].....

View 2 Replies

Security Descriptor Length SECURITY_ATTRIBUTES

May 19, 2010

I am tasked with fixing a service. It is acting like Mutex's are allowing Clients to enter a procedure when it should not. I looked at the security attributes and they are...

[Code]...

View 1 Replies

Storing Settings For A .NET Windows Service: Service Property Settings, Serialization?

Aug 5, 2010

I am working on a .NET Windows Service where I am trying to store settings that will be used when the service is started and while it is running. I have searched through posts on SO and found that using the Settings in the properties of the project is great for use with console and winforms applications. However, Google and SO are silent when it pertains to storing these settings with a windows service.

View 4 Replies

How To Get Security Descriptor Working With CreateNamedPipe API Function

Jun 30, 2010

Can anyone help me figure out how to get a security descriptor working with the CreateNamedPipe API function? At this moment I get Marshal error 1336 "The access control list (ACL) structure is invalid." with the CreateNamedPipe function. All of the other functions seem to be completing sucesfully and are returning proper handles.[code]

View 3 Replies

Datasource - An Expression Of Non-boolean Type Specified In A Context Where A Condition Is Expected - Near ')'

Jun 24, 2011

I am developing a VB.NET ASPX file and am trying to run a string query in VB.NET, but now I get the above error message. How can I determine the cause? Some of the code in this

[Code]...

View 2 Replies

Combo Box And A Property Grid In A Form?

Dec 15, 2011

I have a combo box and a property grid in a form. The combo box contains 2 items. If one item is selected, two properties are listed in the property grid. These properties should have a dropdown that contains a list of items. I have two string arrays that contain the values for these properties. Can I use one TypeConverter that inherits StringConverter for these lists to be displayed in two different properties? That is, with one TypeConverter class, can I populate both the lists? I will also have to do the same with the other items in the combo box.

View 2 Replies

Multiline Drop Down In Property Grid?

Jun 9, 2010

When you drop down the Text property for a label you get a box that allows text entry spanning multiple lines.My question is how do i use this feature in my own control properties?

View 2 Replies

Property Grid Collapsable Sections

Sep 20, 2010

The only thing I am coming up with in my searches is stuff to do with expandable type converters, and all of that documentation is a bit over my head as trying all the examples is failing horribly. I would assume that there is an easier way to go about this without junking up my code with more stuff I don't understand.[code]Now, variables 1-5 have to go under section1, which is what is going on now. However, I want to group together variables 1-4, then group together variables 5-8, so they have the plus sign and can expand. But I cannot apply another category to any of these as they already have a category. All of the other things I have tried putting in additional "<tryexpand("notgonnawork")> _" sections does exactly that, not gonna work.

View 10 Replies

Get A Property Name For A Type Without The Need To Instantiate An Object Of That Type?

May 15, 2012

I have a requirement where I need to have a "type safe" way of accessing property names, without actually instantiating an object to get to the property. To give an example, consider a method that takes as arguments a list of IMyObject and a string that represents a property name (a property that exists in IMyObject).

The methods implementation will take the list and access all the objects in the list using the property name passed... for some reason or another, we won't dwell on that!!

Now, I know that you can do this using an instantiated object, something like ...

Dim x as MyObject = nothing
Dim prop As PropertyInfo = PropHelper.GetProperty(Of MyObject)(Function() x.MyProperty)

Where my helper method uses reflection to get the name of the property as a string - there are numerous examples of this flying around on the web!

But I don't want to have to create this pointless object, I just want to do something like MyObject.MyProperty! Reflection allows you to iterate through a types properties and methods without declaring an object of that type... but I want to access a specific property and retrieve the string version of its name without iteration and without declaring an object of that type!

The main point here is that although I am trying to get the property name as a string... this is done at run time... at compile time, I want this to be type safe so if someone changes the property name, the compilation will break.

View 2 Replies

Grid - How To Set DataField Property By Code In C1flexgrid

Dec 4, 2009

I am useing C1FlexGrid and i set the datatable as c1flexgrid's datasource. now i want to map filed of datatable to columns of c1flexgrid by code.

View 1 Replies

VS 2008 Flag Enums In Property Grid

Jul 10, 2009

I have a flags enumeration property that I need to show in a property grid: [Code] In the property grid however, it only allows me to select a single value. I cannot combine the values like usual in a flags enum. How do I show something like a checked listbox in the property grid, so that the user can combine flags by checking items? A None and All item would be great but not required. [url]

But even that does not work properly. It seems to check and uncheck items arbitrarily. If you check the first and fourth item for example, the second and third items will sometimes be checked too. Yes, I realize that is supposed to happen with the TestEnum property (as that defines 'BottomRight' as 'Bottom Or Right', so that's logical), but it also happens with the SecurityFlags for example, which it shouldn't.

View 2 Replies

VS 2008 Property Grid Sub Items To Have Properties Too?

Dec 5, 2011

i have a clsTest with the following layout:

vb
Public Class clsTest
Public Property Test1 as string
'...

[code]....

how can i make it so when i show clsTest's properties in a propertygrid it has the ability to expand clssettings properties? (kind of how font does it on a text box for example)

View 5 Replies

Setting Property Of A Data Grid View Control?

Nov 15, 2010

I am using VB 2008...

On my form I have a "Combobox1" that pulls a list from an access table. I also have a "DataGridView1" that pulls data from another access table.

I am trying to set the "DataSource" property of the "DataGridView1" after clicking a button, which pulls the "Text" property from the "ComboBox1".

ComboBox1.Text will always equal DataGridView1.DataSource as a text string.

I researched the Get/Set command, but it does not make sense to my specific application. I have read countless articles online for weeks, but I have now taken the next step.

View 1 Replies

Showing Properties Of Child Objects In The Property Grid?

Mar 9, 2010

I have a custom class (Class1) with a bunch of properties. One of the properties of this class is another custom class (Class2) with its own properties.I have a property grid with the selected object set to Class 1. I can see Class 2 as a property, but i would like to expand Class 2 to show its properties in the same property grid.

Im basically trying to do the exact same thing as the Font Class on a form. If you look at the properties of a form in the designer, you can see the font property. You can then expand that to show the properties of the font class.

View 1 Replies

C# - Required Property In Web Service?

Apr 10, 2012

I checked the code example at [URL].. and found one interesting thing: if we remove Public ReadOnly Property Items() from OrderItemData class, the service shows an error. Even if we don't try to access Items, and only working with Orders.Can somebody explain why this property is needed?

EDIT: To clarify: the property isn't used directly. I removed it from the code, it compiles successfully, but service returns Request error: "The server encountered an error processing the request. See server logs for more details." And there is no exception thrown.

I think that the service for some reason might need IQueryable(Of Item) property. Even if the property returns Nothing, the service starts working again:

Public ReadOnly Property Items() As IQueryable(Of Item) Get Return Nothing End Get End Property

View 1 Replies

C# - Property Grid Control Not Allowing Custom Color Editing

Jul 6, 2010

When using the Property Grid and exposing a color property from an object you get this kind of interface for color selection: There are tabs for System and Web, those are fine, but the Custom tab (shown) which seems to be a subset of the standard windows color picker, seems to be hobbled. How do you create custom colors? How do you get custom colors into those white color boxes provided?

View 1 Replies

Show The Error Provider Properties To Property Grid At Runtime?

Feb 23, 2011

In designer i had a button with errorprovider.The button show 3 extra properties at button's property grid in design time.Error on ErrorProvider1

IconAlignmnent on

IconPadding on

But how can i show this 3 extra properties in propertygrid at run time?

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim propertyGrid1 As New PropertyGrid()
propertyGrid1.CommandsVisibleIfAvailable = True[code].....

View 4 Replies

VS 2008 Can't Override ToString Of List(of T) For Purposes Of Property Grid?

Dec 13, 2011

Just say i have:

vb
Public Class Something
Inherits List(Of String)

[code].....

View 5 Replies

VS 2008 Properties In 'groups' (class) In Designer (property Grid)?

Jul 29, 2009

I'm creating a UserControl that draws a simple radial gauge. I need it to be very customizable; the user should be able to customize everything such as the colors, fonts, sizes. So, I just made a property for every customizable detail. For example, I had ScaleFont, ScaleColor, ScaleStart, ScaleEnd, ScaleInnerRadius, ScaleOuterRadius, ScaleTickmarkFrequenty, etc.. etc.. etc...

Because there are so many properties about the same subject, I wanted to 'group' these properties into one "property". I've seen this done loads of times in third party controls, but I've never done it before myself.The idea is that the properties can be accessed like

Me.Gauge1.ScaleSettings.Start = 10
Me.Gauge1.ScaleSettings.End = 80
...

So far, I tried creating a class for each group, for example a clsScaleSettings class, containing properties like Font, Color, Start, End, InnerRadius, OuterRadius, TickmarkFrequenty, etc (corresponding to the same properties as above).

Then, for every 'group' or class, I create a Property. For example, I have the ScaleSettings property, which simply returns an instance of the clsScaleSettings class (I initialize the instance only once of course):

vb.net
Private _ScaleSettings As New clsScaleSettings
Public Property ScaleSettings() As clsScaleSettings

[code]....

Now, this works in the code editor. I can now use

Gauge1.ScaleSettings.Font = Me.Font

for example, and it sets the font correctly.But, I does not work in the designer, in the Property Grid. The whole reason I made the effort to move and rename nearly all properties (about 70!), and all references to those properties, to separate classes, was so that the user could design the gauge more easily using the Property Grid!Instead of having 15 settings related to the scale, scattered all over the Property Grid, he can now have one ScaleSettings property, which he can expand, and then he can edit the properties of that group easily.The ScaleSettings property is greyed out in the property grid... So I cannot expand it and view it's underlying properties.

View 16 Replies

WinForms - Editing Custom Readonly Collection In Property Grid

Feb 19, 2010

I have a custom collection, lets says COL, that derives from ObjectModel.Collection. I have my own collection editor that works fine when a property, of type COL, is Read and Write enabled. However, if I change the property to ReadOnly, the open editor button stops showing in the property grid. As a test, I override my custom editor with the CollectionEditor, and that worked fine. So, my question is, what check is the property grid making, that CollectionEditor passes but my collection editor fails?

View 2 Replies

C# - Refresh Property Grid, At Design-time, When A Readonly Collection Changes In .Net, Winforms?

Mar 3, 2010

I have a class that has a readonly collection property - Its a list of extender providers that have been applied to the control.I've implemented a simple property descriptor for the collection so that the property can be expanded in the property grid to examine each entry.

When I select an extender provider and set it to false, I remove it from the collection. The GetProperties method of the type converter is requeried and the property grid refreshes.However, when I set an extender provider to true, and thus add it to the collection, GetProperties is not requeried.

Somehow, the property grid is making a distinction between adding to and removing from the collection. Or alternativly, its refreshing when an extender provider is added, but not when one is removed.

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved