custom item creation from an object list

3 posts, 0 answers
  1. Alvin
    Alvin avatar
    6 posts
    Member since:
    Nov 2011

    Posted 04 Dec 2011 Link to this post

    Hi,

    I have few questions about how to create custom item in RadListView.

    I have a list of objects and would like to create custom item for each of the object. The value of visualElements of each custom item will get from properties value of associated object.

    By reading the online documents, I know that the custom visual item is created by caling VisualItemCreating event. But how can I trigger the event?

    As I understand the function SynchronizeProperties() is used to assign values to visualElements when the custom visual items are created (please let me know if I am wrong). In the example code, the value assigned to custom visual item are from data table. But In my case I want to assign the value of properties of a object from the object list to each custom visual item. What steps I need to go through to achieve that?

    Thanks a lot
  2. Alvin
    Alvin avatar
    6 posts
    Member since:
    Nov 2011

    Posted 05 Dec 2011 Link to this post

    I seem to find out how this work.

    Thanks
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 06 Dec 2011 Link to this post

    Hi Alvin,

    I am glad that you have managed to sort this out.

    Nevertheless, here is a brief info which might help others as well:

    RadListView uses a virtualization mechanism to display its items. This means that it can contain thousands of logical items while only using a few visual items (as much as are needed to cover the client area of the control). Visual items are stored in a cache and are reused for displaying logical items. When the visual items are not sufficient for covering the client area (at the beginning they are 0), new visual items are created and the VisualItemCreating event is fired. When a logical item is being attached to a visual item, the Attach method of the visual item is called. SynchronizeProperties is called both on Attach and when the logical item changes some of its properties (this reflects changes in the logical item directly to the visual one, if such exists). In addition, every visual item has a IsCompatible method which should indicate whether this visual item is compatible with the given logical item. If there isn't any compatible item in the cache, a new visual item is created and the VisualItemCreating is fired again.

    I hope you find this helpful. If you have any further questions on this, do not hesitate to ask.

    Best wishes,
    Ivan Todorov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Back to Top