Visual Studio 2010 Property Search - c#

In Visual studio 2010 Is there any extension to search for controls in tool box? Is there any way to filter properties of a control? There are lots of properties for a control for e.g. (Name, AcceptsReturn, AcceptsTab, AccibleName, Text, Visible, Top, Left etc.). I want to go directly to "Visible" property of the control. Is there any short cut or any extension?

No there is nothing like that ..
If you have many control in your form and trying to set any specific property of all your controls like "Visible" property then you can select all your controls by holding shift or Ctrl key and change property value in property panel.
or if you want to change it 1 by 1 then
select your first control select property from property panel now type applicable property value
now on next control selection you need not to select property name again from property panel just type applicable property value it will change for respective control, dot net IDE will remember which property earlier you had selected.

You Can do it with Rapid Design

Related

Is there a way to set a certain property for all controls in a form at once in the Designer?

I want to set a certain property (Anchor) of all the controls in my main form at once.
There are around 100 controls and I really don't want to change this property for each single control manually.
I know I can select all available controls at once by typing Ctrl + A. The problem then occuring is that the desired property I want to change is not visible in the Properties window. And normally it should be visible because all the controls are a type of Control, shouldn't it?
I also know that I could do it like this:
foreach(Control ctrl in myForm.Controls)
{
ctrl.Anchor = AnchorStyle.Bottom;
}
But I want to know if thers's a way of doing this using the Designer. Is there any?
Usually if controls derive from the same base, you can select them all at once (using the mouse click and drag or holding down ctrl or shift while selecting them one by one), and then you can set any property that they all share from the base class.
You can multi-select all controls on the form and see the Anchor property in the Property Grid. When you edit that with multiple controls selected, each selected control will be set to the Anchor value you specify.
But be careful with Ctrl-A--it will select visual controls as well as non-visual components. So if you have any components on your form that don't render in the client area of the form (such as the Timer or FolderBrowserDialog form components), the Ctrl-A will continue to show common properties--but because these components don't have an Anchor property, the Anchor property won't appear. The only properties to appear when multiple controls on a form are selected are those share by all selected controls.

Add checkbox in the propertygrid

i used PropertyGrid control to display properties on gridview.
i have taken an reference of this link http://www.c-sharpcorner.com/article/using-property-grid-in-c-sharp/
which is showing like this
But i need checkbox just before the property name shown in red mark on check/uncheck for any property i need to build expression.
I recommend reading this: How do I change boolean properties with one click in PropertyGrid.
It extends the PropertyGrid control and defines its checkbox controls using UITypeEditor.
As Reza mentioned, your choice of control does not appear optimal. You should probably create a form with TextBox, CheckBox, ComboBox etc. Or make use of DataGridView if your display is catering for multiple records at same time.
If you most definitely want to customize PropertyGrid, here is my another answer which might help you start with.
Linked answer:
You can make use of TrackBar. Note that PropertyGrid by default does
not allow you to add controls like these to it. So, you will need to
do some work here. You will need to create a class that inherits from
System.Drawing.Design.UITypeEditor. Next you will have to set the
editor attribute for the property that has to display track bar as
control. Note that unless you do custom paint, it will be shown as
modal dialog or as dropdown editor.

In a property grid is there a way to unselect all grid elements programatically?

I am working on a project in which I am using a property grid to display the properties of the selected control.
The Property Grid is fixed to the left edge of the container and in the rest of the space I have the form I am designing.
On clicking a control on the form, the specific control’s property is getting selected.
In the above figure, I have selected the textbox and the textbox’s properties get shown on the propertygrid.
Here if you observe, by default, the Name property is highlighted as well.
Is there some way to unselect this property programmatically?
I have tried some suggestions online but none have helped. I am not able to find find a way to remove all selections from the PropertyGrid, but its behaviour seem to be different form a DataGrid...
Here is why I need this...
On selecting a control, if a property in the property grid is selected, then the property is getting modified.
For example, If i cut the control using Ctrl + X, the selected value in property grid is getting cut which in some cases is forcing user to set the property before modifying anything on the form.
I have tried selecting multiple controls, but in that case alse the selected property seems to be persistent
Since PropertyGrid uses DefaultProperty to select a property in its grid, as an option you can set DefaultProperty attribute at run-time for your object to a non-browsable property, for example:
this.propertyGrid1.SelectedObject = null;
TypeDescriptor.AddAttributes(someControl,
new Attribute[] { new DefaultPropertyAttribute("Site") });
this.propertyGrid1.SelectedObject = someControl;
Well, what you are trying are hacks. It is never a good idea to do such hacks particularly if you are not the only person that use the software.
In your case, the focus should be on the designer while you interact with it. So if the user press Ctrl+X, the designer should respond to the keyboard and it should not have any effect on the property grid (as only one control can have the focus at the same time).
Thus it is up to you to make sure that your designer is focusable, that it has the focus when initially displayed, that it get the focus when you press the TAB key. Pressing the TAB key again should put the focus on the property grid so that user can interact with the grid without using the keyboard.
If you have more than these 2 controls, then obviously TAB should also stop at any appropriate controls. Also, it can be a good idea to have some direct shortcuts like F4 to (show and) activate the properties pane.
If you are not able to make it works, then the best compromise would be to use another windows for the properties grid. By using a distinct Tool windows for the properties, it should not respond to the keyboard when the main windows has the focus.
Here are some links that might help you:
Panel not getting focus
Control.Focus Method() — See Remarks section.
In any case, you should not prevent Ctrl+X to works as expected when the property grid has the focus and a property is selected. Users don't like software that do not follows UI conventions.
As a software developer, you should as much as possible ensure that your application follows standard behaviors. I recommend you that you take one or 2 extra days developing your software properly instead of doing hacks.
Often, compromise to gain a few days will never be fix and will be a pain for many years. Better to do it right from the start. Unselecting an item in the property grid is not an acceptable workaround. Your manager should not allows you to do that.

How can I create a table like Visual Studio's watch window?

I want to display data about some objects in my program, in a way similar to how Visual Studio's watch window works - A tree list with two columns, name and value, with the ability to expand non-primitive members further as child nodes in the tree structure.
I've been trying to do this with ObjectListView, but I can't seem to get it to happen. OLV seems to want to stick the members in individual columns, horizontally, while I want them to be displayed vertically, under the parent object (if that makes sense).
For winforms project there is a control - PropertyGrid that does this almost automatically, you need to set some attributes on the properties:
[ReadOnly(bool)] – is the property read only.
[Browsable(bool)] – is it browsable, i.e to show in the property grid or not.
[Category(string)] – the parent group of the property
[Description(string)] – the description. It is displayed on the bottom label when you select the property.
[DisplayName(string)] - you can override the display name.
Additional information you can find here: https://msdn.microsoft.com/en-us/library/aa302326.aspx

How to make something similar to Visual C# 2008 properties window?

What interests me is everything below the bar with buttons that determine how the properties are displayed. All I can figure out is there is a splitter and a status strip.
What I'm after is how there are 2 sections which I want to add the titles Property and Value, the sections can be resized with a splitter (I assume a splitter is used in this case), each property can be selected and the corresponding description appears on the status strip, and each value can either be text or a dropdown box.
The coding part I can probably do by myself, what I need to know is what controls the window is made up of and how it's put together.
You are referring to the PropertyGrid control. It's in the ToolBox.
See Getting the Most Out of the .NET Framework PropertyGrid Control
This is the PropertyGrid, and can be used directly. There is no need to reinvent the wheel here...

Categories

Resources