What is the name of this form?(That is if I want to search for it, what should I search for?) and is there a way to extend it ?
The control on the right side is a PropertyGrid - so i guess it is filled by reflection. If you derive a custom type from DataColumn, this control should show all new properties as well. Here is a detailed description, which attributes you should use to decorate your properties, so that a description shows up, the right editor is shown, etc.
Related
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.
I have an Internal Link Field in a custom template in Sitecore 8. I want the user to use the Link Field to ONLY select a (say) PDF File from the Media Library. When clicking on "Insert Link" the Media Library pops up, scoped to the node I set in the DataSource Field. In here, I want the user to only see PDF files.
Is there any chance this can be done with the Internal Link Field?
Or maybe some other way around that problem? I don't want to have a custom Field Validation that prevents the user from saving the actual item. I'd rather have the user not selecting any "wrong" files for the field.
Thanks in advance.
Out-of-the box you will not be able to do this. You have a few options that I can think of right now:
Change the field type to treelist (or treelistEx) and use Datasource=/sitecore/media library/....&IncludeTemplatesForDisplay=Pdf,media folder&IncludeTemplatesForSelection=Pdf as datasource - your datasource will do exactly what you want but your editors will be able to select multiple pdf's (this can be checked with validation but you wanted to avoid that)
Change field type to droplink and use query:/sitecore/media library/....//*[##templatename='Pdf'] as datasource - now they can only select one, but you get a flat list of items and that might be not that easy to work with
Create a custom field type for a link with datasource: this is more work but could give you exactly what you want and it seems like it has been done before.
I have an existing custom control library with controls which may contain properties: HeaderStyle, ModalStyle, Collapsable, etc...
In the user interface the program is currently displaying a categorized list of these properties. I am trying to update this code to hide properties they dont normally use. I have a list of properties to hide/show based on button click but I am not sure how I can hide these fields programmatically.
I would like to retain any values entered into the fields before hiding and re-display the values if the fields are shown again.
Here is a property that current exists but would like to be hidden/shown on toggle.
/// <summary>ModalStyle property for control</summary>
[XmlAttribute]
[DefaultValue(Utility.Common.Enumerations.ModalStyle.None)]
[Category(PropertyCategories.Rendering)]
[Description("Modal dialog style")]
public ModalStyle? ModalStyle
{
get { return control.ModalStyleActive; }
set { control.ModalStyle = value; }
}
My original though was to do some variant on #if DEBUG but use my own Conditional however I was unable to find a way to change my conditionals via button/toggle.
Can anyone please help with a solution to my problem? I have 20-30 controls with 20 to 30 properties that would like to be filtered.
I have two suggestions that, while they may not give you the exact functionality desired, will keep your solution much more straight forward.
First:
Since you are the library developer you should just decide what properties you want other developers to have access to though the IDE properties window. If a property is seldom used or not very useful through the IDE then just place the [Browsable(false)] attribute on it.
Second:
If you really want all properties to be visible in the IDE properties window, but want to give individuals a way of hiding the more advanced (or less used) ones, just throw them all in an 'Advanced' category. The user can then simply collapse that category and forget about them.
Also: Take a look at Oliver's answer to this question:
[how-to-show-or-hide-properties-dynamically-in-the-propertygrid]
I'm not sure to understand what you are trying to achieve.
When you use Attributes, those are static to the class. So, in your case, when you toggle a show/hide on an object, it's on an instance of the object. Also, you cannot change an attribute value at run-time.
Maybe you should try an alternate solution like creating a global
map<pair<type of object, property name>, is shown>
and update that accordingly from your editor.
And if you want to use something like a property grid, you will have a problem since it won't check your map, but it can be fixed. You could create a new class at run-time and make it a proxy to your current instance. (check on the net how to achieve that, but it's quite simple. There are 2 possibilities: compile from a string or use the ILGenerator.
Hope this help.
I want to add a tool tip for items in a Property Grid. When the user hovers over a property I want the tooltip to display a hint about the usage of that property. The hint string should be different for each different value of the property — for example if one property is a list of strings each string would have a different hint.
Is this possible?
The PropertyGrid is not very flexible and doesn't expose any of the individual controls on it. You can access the control (textbox or dropdown) that you're looking to show the tooltip on via reflection but that is far from trivial, especially since all the control classes are unique and internal to the property grid.
Using the Description attribute is by far the best value. If your list of strings for that property aren't obvious enough to portray their meaning without providing a tooltip, perhaps you should revisit the string text you are showing for each item in the list.
I have around 30 elements/objects for which i need PropertyGrid to show their properties in it,but the problem is that every object has different properties so i created a database for it.
I don't know how to add properties in PropertyGrid from the Database.
I am going to assume that you are using Windows Forms, since you are asking about PropertyGrid. If you have objects (meaning classes) that have the properties you want to display in your PropertyGrid, you need only to set PropertyGrid.SelectedObject with the object you want to display. By default, PropertyGrid will use reflection to find all the public properties of your object, and will display them.
You can use various attributes to control how PropertyGrid displays properties. For example, you can apply the Description attribute to a class property to add help text that the property grid will display. You can use the Browsable attribute to control whether PropertyGrid will display a given property. There are other attributes in the System.ComponentModel namespace that you can use.