Propertygrid field notes

Posted by: kisar on 11 April 2018, 6:05 pm EST

    • Post Options:
    • Link

    Posted 11 April 2018, 6:05 pm EST

    Hi

    is there possibility to display in the propertigrid some “notes” or description explanation of field, next or as tooltip using attributes?

    Is it possible change the displayed name using general DisplayAttribute or DisplayName Attribute instead of C1 Attributes?

    Thanx

  • Posted 12 April 2018, 8:26 pm EST

    Hello,

    Using C1PropertyGrid, one can show description for any property, this can be done by setting ShowDescription property to true.

    Re. changing the name of the property, you can use DisplayAttribute and set its Name property as follows:```

    [Display(Name = “Customer Name”)]

    public string Name { get; set; }

    
    Hope it helps.
    
    
    Regards,
    Ruchir Agarwal
    [zip filename="C1PropertyGridTest1.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-e12a33be-232e-476e-8c70-2a2172f120ed.zip[/zip]
  • Posted 15 April 2018, 2:11 am EST

    I tried your code but i continue to see he field name and not the Display Attribute,

    is it possible that the problem is my version of library (v4.0.20163.533)

    I also checked how you show the tooltip, they are in the xaml code, but i would like use information stored in attribute (like descriptionattribute). is it possible?

    thank you

  • Posted 15 April 2018, 4:47 pm EST

    Hi,

    For setting the description in code and not in xaml, you may set the Description property of Display attribute as follows:```

    [Display(Name=“E-mail address”, Description:“This is the virtual/internet address of the customer”)]

    So, if you are still not able to see the name and description according to the value set in [i]Display[/i] attribute then we request you to share your application or stripped version of your application showing the issue.
    
    Regards,
    Ruchir Agarwal
    [img]https://gccontent.blob.core.windows.net/forum-uploads/file-6ca4a92e-dc2d-4994-8efc-758e01ae1667.gif[/img]
    [zip filename="C1PropertyGridTest_descrp.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-0bd20da1-a4c6-4c10-82ef-51789e9b63cd.zip[/zip]
  • Posted 15 April 2018, 5:37 pm EST

    Hi,

    thanx for the answer.

    I cant see the displayed name also in the example that you sent me.

    I simply opened the solution with my vs2017 and run.

    I attach my screenshot.

    Have you some suggestion to try for me?

  • Posted 16 April 2018, 4:11 pm EST

    Hi,

    I tried running the application at multiple machines, even having different OS versions. But

    following the below mentioned steps, the description of the selected property gets displayed properly correctly everytime.

    1. Extract and run the above attached application.
    2. Select/Click any property (name).
    3. The associated property description gets displayed properly (in the box at the bottom of screen).

      For reference, please refer video attached in previous response.

    To see the issue, could you please share a video showing the steps you are following.

    Thanks,

    Ruchir Agarwal

  • Posted 16 April 2018, 5:47 pm EST

    Hi, finally comparing the two project i understood the problem,

    in the first example, the xaml code had

    this property attribute inside that override the class attribute,

    thank you for the help

            <c1:C1PropertyGrid.PropertyAttributes>
                <c1:PropertyAttribute Browsable="True" MemberName="Name" Description="Shows the Name of the customer"/>
                <c1:PropertyAttribute Browsable="True" MemberName="EMail" Description="Shows the e-mail address of the customer"/>
                <c1:PropertyAttribute Browsable="True" MemberName="Address" Description="Shows the physical address of the customer"/>
                <c1:PropertyAttribute Browsable="True" MemberName="CustomerSince" Description="Shows the date since the person has become a customer"/>
                <c1:PropertyAttribute Browsable="True" MemberName="SendNewsletter" Description="Shows whether/not to send NewsLetter to the customer"/>
                <c1:PropertyAttribute Browsable="True" MemberName="PointBalance" Description="Shows the point balance of the customer"/>
            </c1:C1PropertyGrid.PropertyAttributes>
    
  • Posted 16 April 2018, 6:27 pm EST

    Sorry,

    but i trying the cose in my solution, i had the same problem.

    So i checked better your code and everything works because you

    use the namespace C1.WPF.Extended for the DisplayAttribute.

    If you substitute it with the standard System.ComponentModel.DataAnnotations

    you will have my same problem.

    So the component works only the C1.WPF.Extended attribute?

  • Posted 16 April 2018, 8:22 pm EST

    The project I shared with you dated 16 April did not had any C1PropertyGrid.PropertyAttributes in xaml, since you mentioned that you did not want to use xaml and instead use DescriptionAttribute.

    Re. the C1.WPF.Extended assembly: Yes, referencing this assembly in your project is essential since the control C1PropertyGrid is present inside this assembly and this assembly also includes the DisplayAttribute using which we are showing the description of properties, as shown in the video attached dated 16 April.

    Hope it clarifies

    ~Ruchir Agarwal

  • Posted 16 April 2018, 8:44 pm EST

    Ok, now it’s clear the component works only with C1.WPF.Extended assembly.

    If i can suggest, this is little bit limitating, because, example in my situation i have the class in other library that does not know what will be the final ui (web, wpf …etc)

    thanks for your availability in the assistance

  • Posted 17 April 2018, 5:53 pm EST

    Hi,

    We are sorry but this control is available for WPF platform only. Hence, it would not be possible to use it over other platforms.

    Apologies for the inconvenience caused due to this.

    Regards,

    Ruchir Agarwal

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels