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


ADVERTISEMENT

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

VS 2008 Set A User Control (or A Class With A Few Properties) To Appear In The Tan Bar At The Bottom Of The Designer?

Apr 5, 2010

How do I set a User control (or a class with a few properties) to appear in the tan bar at the bottom of the Designer? I have tried googleing it but, I don't know what that bar is called (Kinda Hard to Google without know what to Google)

View 2 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

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

Possible To Override An Autogenerated Property In Designer File Using A Partial Class?

May 31, 2012

I am using Linq to Sql that generated a data contract for a table. I have a date field in that table which is a non-nullable field. I need to override the auto generated property of the date field to return a specific value, something like [code]Is it possible to override an autogenerated property in the designer.vb file using a partial class? I dont want to create a new property as it is currently being accessed in n number of places and I dont want to change it in every place.

View 1 Replies

Wpf - Property Notification When Binding To Class Not Properties?

Jun 13, 2011

I have a window that contains different functional areas of an account. The details, roles, type, contracts The window's DataContext is set to the 'AccountViewModel'. Inside the AccountViewModel, there are properties one of them being 'Account' which contains the details. I need for the user to be able to update these details. How can I notifiy the properties to call my Update() code when they are changed?

Here is what I have

<TextBox x:Name="txtAccountNumber" Grid.Row="0" Grid.Column="1" Text="{Binding Path=Account.AccountNumber, UpdateSourceTrigger=LostFocus}" />

[Code]...

View 1 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

C# - RefreshProperties Attribute At Class Level In .net, Winforms + Incorrectly Refreshing Property Grid?

Feb 15, 2010

I had a strange problem editing a class in the property grid whereby the property grid would refresh incorrectly.I managed to reduce the problem down to a class with just two properties. I've included the code at the end to ease explanation.It basically boils down to a class with two properties. The first of which is expandable (a font)The class itself is expandable and also implements the CreateInstance method in the type converter.To see the problem, expand the font, edit, say 'Bold', and tab away. Two problems happen:

(1) The second property jumps up and ends up in the expanded font property.

(2) The '-' sign of the expanded font changes to a '+'.

The problem goes away by attaching ResfreshProperties(RefreshProperties.All) to the class. That's great, but I'd like to understand how it fixed the problem. I've had a look in reflector and can't find any examples of RefreshProperties being attached at the class level.

[code]...

View 1 Replies

Expose A UserControl's Properties To Properties Window In Designer?

Aug 19, 2009

Is there a way to expose a UserControl's properties to the Properties Window in the Designer?

View 3 Replies

VS 2008 - Any Way To Create Designer Class?

Sep 13, 2009

Is it possible to create a designer class in VB express? Because I can't import this namespace: System.Windows.Forms.ControlDesigner.

View 2 Replies

User Control Properties - Finalize My Design Time Properties Grid

Apr 27, 2011

I'm making a control and I am trying to finalize my design time properties grid. I have several List(of Class) items as public properties and when I click on the design time menu (while testing the control) there is the word "Collection" and a button with an ellipsis (...) that brings up a neat pop up with the buttons Add/remove and all of the public properties of the collection's class on the right hand side. Basically for a non-collection instance of a class (with public properties) I'd like a similar button to show up. I know I could put all of the properties in the main control class and group them, but I like the pop up box feature. Anyway to duplicate this? (think font grid item etc.)

View 3 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 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 Partial Class Files For Windows Forms Or Any Other Designer-generated Control?

Sep 24, 2009

I have cooked up my first iteration of a code generator which creates the basic Entity models from a SQL Database Schema. Currently, It will scan a SQL Db Schema, and create .vb code files complete with private members and Public property declarations for every User table in the Database. My next step is having it add the basic CRUD procedures as well. Are we mere mortals able to access whatever technology allows the Partial class files created by vs to be hidden/Linked to their "parent" files, such as the Partial Class files for Windows forms or any other designer-generated control? My thinking is that it would be handy to be able to re-generate code files from the database if necessary to reflect changes in the schema, without overwriting any other properties or methods added to a class in addition to those derived from the database. SO I am hoing I can have the Auto-generated output go to a Partial Class file, and then use a regular class file of the same name for the rest of the code. My Concern is the multiplicity of files that might result, so I was hoping it is possible to "tuck them in" to the parent code file in the Class View.

View 7 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

Set The Transparent Property Via Label Properties Properties Not Via Code?

Jan 16, 2009

I'm working on a Hazardous Materials label printing program. One of the options is to do an "NFPA" label. Since there are 4 values required with 4 or 6 options, the ratings are entered via radio buttons in a group box. That's working okay. I display values in the NFPA diamond as they're entered: left quadrant blue, top quadrant red, left yellow, bottom red. I'm having trouble with the label in which the rating will be displayed on top of a jpg diamond for the white. In this quadrant the text can be up to 4 characters. I can accept the text going into an adjacent block a little, but the corners of the label overlap into another quadrant/color. I reduced the font size which solved the overlap problem but the font is then too small and looks terrible. I tried to make the background of the label transparent to let the color come through correctly but that's not a valid value for label.background. I'm figuring that the transparent background is the best solution. What can I use that will accept a transparent background so the color shows through?

I'm trying to set the transparent property via label properties properties, not via code. Here's the code if it makes any difference:

Public Class NFPA
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Close()
End Sub

[code]....

View 2 Replies

Properties Not Being Committed To Designer?

Sep 23, 2011

I am trying to change some properties with a property page during design time. The properties get set okay and the form updates (graphically) and the new properties appear in the property list, however they do not get written to the designer. If I close the form I am on and then reopen it the changes have been purged. However, if after I make a change with my property page, I manually change anything on the form, then it knows it is dirty and commits the changes to the designer.

View 3 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

Snap To Grid Or Not / HTML Designer And Absolute Positioning

Jul 1, 2010

I installed VS2008 and just VS2010, both allow me to freely move objects around in the HTML Design View.However, I would like to be able to snap the objects in alignment.It is hard to space text boxes and buttons when everything is free flowing.

View 2 Replies

.net - Inherited Properties Are Not Editable In Designer

Dec 29, 2010

I have a base form class that is providing a new property that looks Like this

Public Class BaseForm
Private _HappyTime As Boolean
Public Property HappyTime() As Boolean

[Code]....

Now when I inherit the BaseForm on a new form, the HappyTime property displays in the properties window as false, and is uneditable.

I've recreated this BaseForm and Inheriting Form in an entirely new soloution and, the HappyTime property is editable and works as expected. For some reason in the existing project (where these changes need to be made) it's not behaving properly.

Environment Information: .Net Framework 3.5, Visual Studio 2010, Win7 x64

View 1 Replies

Set The Properties On A Custom Control In The Designer?

Mar 21, 2010

Is it possible to make a form that can set the properties on a custom control in the designer? What I mean is I want to know if it is possible to show a dialog that allows you to set the settings for a certain property like if you were adding items to a listbox.

View 3 Replies

Setting Control Properties In Designer

May 1, 2009

I've played around with this and have figured most of it on how to set the properties of most controls in the designer. I have 2 check boxes I need to set the values on but do not know how. 2 fields one for each in the db with a char(1) value, can be Y or N. If it a Y in the db how would I set it as checked on the form?
'cboPosition
Me.cboPosition.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", Me.FmfieldmanmasterBindingSource1, "position_name", True))
Me.cboPosition.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.FmfieldmanmasterBindingSource1, "position_name", True))
[Code] .....

View 9 Replies

VS 2008 Adding Properties To Class?

Aug 4, 2009

I created this custom listbox, and I want to change the border of the focus rectangle, so I made up this property:

vb.net
Private H_BorderColor As Pen = Pens.Black
Public Shadows Property HighlightedBorderColor() As Pen

[Code]....

But when I'm at the designer tab that property is editable, I attached a screen shot of the properties box.

View 10 Replies

VS 2008 Using ENUM Definition In Class Properties?

Jul 28, 2011

In a global module, I define a new type that can take 4 values:

enum tAction as integer
None
Update
Insert
Delete
end enum

A use this type in many places in my code to check the value stored in a variable (if MyAction = tAction.Delete then ...)

In a separate file, I define a class. One of the properties should return a value of this type:

public class XXX
private _Action as tAction
public property ClassAction() as tAction

[Code].....

This way I could check a class property in the same manner (if MyClass.ClassAction = tAction.Insert then ...)

However I get a syntax error in the property definition: 'ClassAction' cannot expose type 'Globals.tAction' outside the project through class 'XXX'

My entire program consists in a few modules, in a single project. How can I use my tAction definition in my classes?

View 4 Replies

ASP.NET - Ascx.designer 'properties' Not Showing Up In Reflection At Runtime

Jul 2, 2010

I have a very simple setup, single mycontrol.ascx with assoicated mycontrol.ascx.designer.vb and mycontrol.ascx.vb file.

mycontrol.ascx embeds a single reference to a custom control: "MyMenu":

<mM:myMenu id="myMenu1" runat="server" />

This has created a protected reference in the mycontrol.ascx.designer.vb file:

Protected WithEvents myMenu1 As Global.CustomControls.MyMenu

Now, when I breakpoint the Page_Load() event of mycontrol.ascx, and inspect the members returned from the type via:

Me.GetType().GetMembers()

I cannot any reference to myMenu1. If I look at the control with intellisence, the property is accessible:

Me.myMenu1

what I'm missing and what I need to do to access designer created properties at runtime through reflection?

View 2 Replies

VS 2008 PropertyGrid Class Properties - Define The Color

Oct 21, 2009

1 - Need to create a kind of composite property, like the font property, that it's showed with a plus sign to expand. For example i need to define a new pen, i need to define the color and the width... 2 - I need to define the color for one brush, but if i create a property of the type brush in the PropertyGrid it appears like "System.Drawing.SolidBrush"

View 2 Replies

VS 2010 Properties Set During Design-time Are Not Serialized To Designer File

Aug 22, 2011

I am creating a UserControl with rich design-time support that should eventually look like the Options window in Visual Studio (or many other applications). Basically a split container, to the left is a TreeView with 'option categories', and each node in the treeview corresponds to a 'panel' to the right with certain options.

Just for terminology, the nodes in the TreeView are OptionsNode objects, the panels (containing the controls that determine the options) are OptionsPanel controls. My UserControl itself is called OptionsView and is the control that contains the treeview as well as a panel that contains the OptionsPanels.

I have some experience in design-time coding, and I have gotten pretty far. The OptionsView control contains a property Panels that returns the ControlCollection of the right side of the split container. The user can add/remove OptionsPanels via this property (and automatically an OptionsNode is created). The property uses a custom CollectionEditor that tells the designer to create instances of type OptionsPanel (instead of just Control which is the usual collection type of ControlCollection). Furthermore, in the CreateInstance method I use the DesignerHost object and its CreateComponent method to create the panels, instead of just creating New OptionsPanel objects. This way the OptionsPanel created is selectable and editable (via property grid) during design-time:

vb.net
Protected Overrides Function CreateInstance(ByVal itemType As System.Type) As Object
If itemType Is GetType(OptionsPanel) Then

[Code].....

View 1 Replies

Sum The Properties Of Two Members Of A Collection Without Doing It Property By Property?

Aug 8, 2011

I've reviewed the links that were offered and don't find an answer. Neither has a lot of searching helped, probably because I can't think of a reasonably short way to ask the question. I hope that I've at least found the proper forum and category.

In my VB 2010 code, I've defined a structure that has about 30 elements. I want to sum the properties (they are all singles) of two members of the corresponding collection. I understand that I can do something like:

member1.property1=member2.property1+member 3.property1 for the entire set of properties of member2 and member3 to produce a completely defined member1 What I wonder is whether or not there is a way that uses fewer lines of code - I know that I can't do:member1=member2+member3, for example.

View 7 Replies







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