Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I'm trying to create a custom control for my Windows Phone 7.1 application, that displays a dotted graph of data.
Currently, I'm using a custom ListBox derived from standard listbox with a custom panel as its itemspanel.

The code of custom Listbox is really simple:
C#
public class GraphListbox:ListBox
    {

        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            base.PrepareContainerForItemOverride(element, item);
            if(item is IGraphable){
                element.SetValue(GraphPanel.GraphYValueProperty, (item as IGraphable).GetGraphValue());
            }
        }

    }


The custom panel arranges the ListBoxItems based on the value of their GraphYValue attached property.

It works OK, but the initial rendering is really slow (e.g. it takes 5-6 seconds for 600 items), perhaps due to the large number of visuals. I thought, that I could render the items into single DrawingVisual object, since I don't necessarily need selectable items.

My problem is, that I couldn't find the DrawingVisual or Visual classes for this version of Windows Phone.

Can I render the items faster or what is the fastest rendering technique? Would it help moving to WP 8.0? (Which I'd like avoid)

By the way, I considered drawing e.g. Ellipses for each dot on a Canvas, but I don't know how fast would it be, especially compared to the one DrawingVisual object available in "large" WPF.

Little update: using a custom class derived from Panel, that is drawing just one Ellipse for each data item seems to be quite fast. At least, my app is not stuck for several seconds.

Second little update: Finally, I decided to use one single polygon object, that is created when I set the item's container to my chart object. I guess it uses the least visual objects and what is more important, it looks better - at least for me. I think I found satisfactory solution, but I appreciate any other suggestions
Posted
Updated 25-Feb-15 16:30pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900