Hi -
I want to create a custom editor that has just a textbox and a button. The button will launch a form that allows me to select an object of type Product. When I click OK on the form, I want to display the Name property of the object (in the text box in the grid, as read only), but I want the VALUE to be a different property, in this case ID.
My object looks like:
class Product
{
string Name;
Guid ID;
}
How can this be achieved?
Thanks in advance!
Hi,
I've managed to work out most property types but I'm struggling how to have a property in Time format.
I.e. is there a time editor like RadTimePicker within the propertygrid to enter a specified time?
Thanks.
we have the following property:
private Size _picSize = new Size(1272, 787);
public Size PicSize
{
get => _picSize;
set => value;
}
if in the radpropertygrid for this property to remove the height and semicolon, press <enter>, an error occurs:
System.ArgumentException: Не удается разобрать текст "1000". Ожидаемый формат текста: "Width,Height".
в System.Drawing.SizeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
в Telerik.WinControls.UI.PropertyGridItem.ConvertValue(Object value, Object& convertedValue)
в Telerik.WinControls.UI.PropertyGridItem.set_Value(Object value)
в Telerik.WinControls.UI.PropertyGridTableElement.EndEditCore(Boolean commitChanges)
в Telerik.WinControls.UI.PropertyGridTextBoxEditor.OnLostFocus()
Hello,
I'm trying to show and hide groups and single items of a PropertyGrid depending on the answers inside the same propertyGrid.
I've seen that a good place to set the visibility of the group is in when the grid is created, in this function:
private
void
RadPropertyGridOnCreateItemElement(
object
sender, CreatePropertyGridItemElementEventArgs e)
{
if
(e.Item
is
PropertyGridGroupItem groupItem)
{
var myItem = (MyItem)groupItem.Group.GroupItem.GridItems[0].Value;
groupItem.Visible = myItem.EnableGroup;
}
if
(e.Item
is
PropertyGridItem item)
{
var myItem = (MyItem)item.Value;
item.Visible = myItem.EnableItem;
}
}
However, I'm not able to change the visibility at a second time, since this function is not called again later.
If I try to change the visibility of the VisualItem in OnItemFormatting, the items are hidden, but the spaces are not recalculated and the design is messed up.
Also, if I try to change the visibility of an item at the end of OnEdited, OnItemFormatting goes on loop.
Any hint? :)
Thanks!
I have the following
class LookupItem
{
public Guid Id {get;set;}
public string Description {get;set;}
}
class SomeOtherClass
{
public int Key {get;set;}
public Guid LookupItemId {get;set;}
public string SomeProperty {get;set;}
}
Now.
The LookupItem class will be a part of a collection (or lookup list) e.g. List<LookupItem>
The SomeOtherClass is the selectedObject of the propertygrid
I have looked through the samples such as https://docs.telerik.com/devtools/winforms/knowledge-base/propertygrid-dropdown-editor
and whilst I can get the combobox or RadMultiColumnComboBox to display when editing, I need to be able to show the description value of the selected lookupitem in the propertygrid item. Currently its displaying the LookupItem.Id which is a Guid.
Any ideas? The simplest will suffice
if you completely delete the contents in the editor and press the <Enter> key, then int.MinValue is returned.
Why? In this case, you must return either null or 0 or do nothing.
I override the BaseInputEditor with a trackbar editor (using code from Telerik website).
But when I change the position of the trackbar, the PropertyValueChanged event does not occur (radPropertyGrid)
What am I doing wrong?
Hi,
I need a PropertyGridSpinEditor with a small difference, it must always show 2 digit. Example: "00", "03", "14"..
You can see in the image, i have achieved only when the edition has ended with this code.
Private Sub PropertyGridParams_ItemFormatting(sender As Object, e As UI.PropertyGridItemFormattingEventArgs) Handles PropertyGridParams.ItemFormatting
If (e.Item.Name = NameOf(PROPNAME)) Then
DirectCast(e.VisualElement, PropertyGridItemElement).ValueElement.Text = PROP.ToString(
"00"
)
End If
End Sub
I try it, but doesnt work.
Public Class NumericUpDownEditor
Inherits PropertyGridSpinEditor
Public Overrides Sub OnValueChanged()
If (Me.Value.ToString.Length < 2 AndAlso IsNumeric(Me.Value)) Then
Me.Value = Integer.Parse(Me.Value.ToString()).ToString(
"00"
)
Else
MyBase.OnValueChanged()
End If
End Sub
End Class
Is there any way to achieve that?
Thank you!