Can I change category name run time

3 posts, 0 answers
  1. Hakan
    Hakan avatar
    2 posts
    Member since:
    Apr 2007

    Posted 10 Jun 2013 Link to this post

    Hi ,
    When I bind a object in propertygrid like a

    PsPropertyGrid1.SelectedObject = MachineConfig
    I want to change Category name at runtime for localization

    I can change Item name and description with ItemFormatting event as fallow but Categoty property is readonly ,
    How can I change category attirubute name at runtime in radpropertygrid... 

    Private Sub PsPropertyGrid1_ItemFormatting(sender As Object, e As Telerik.WinControls.UI.PropertyGridItemFormattingEventArgs) Handles PsPropertyGrid1.ItemFormatting
                Select Case e.Item.Name
                    Case Is = "MachineID"
                        'e.Item.Enabled = False
                        e.Item.Label = RM.GetString(7760)
                        e.Item.Description = RM.GetString(7761)

                    Case Is = "CompanyInfo"

                End Select

    Thanks for all helps...

  2. Ivan Petrov
    Ivan Petrov avatar
    701 posts

    Posted 13 Jun 2013 Link to this post

    Hello Hakan,

    Thank you for writing.

    The best way to localize all the items displayed in the property grid is through the Label property. RadPropertyGird uses the label property to determine what text to display for an item. The Label property works the following way:
    1. It checks whether there is a label set explicitly, if this is the case then it returns this label
    2. It checks whether there is DisplayName attribute applied to the property, if this is true it returns the attribute value.
    3. Returns the property name.
    In the case of category items step two is skipped. So whenever you change the display language you can iterate over the items and assign the localized values.

    I have attached a sample project where I have implemented an example localization using the Label property. Also to localize the UI elements of the property grid you can use a localization provider.

    I hope this will be useful. Should you have further questions, I would be glad to help. 

    Ivan Petrov
    RadChart for WinForms is obsolete. Now what?
  3. DevCraft R3 2016 release webinar banner
  4. Hakan
    Hakan avatar
    2 posts
    Member since:
    Apr 2007

    Posted 13 Jun 2013 Link to this post

    Thank you for your help Ivan. I solved my problem ...
Back to Top