Reputation: 43
I made a simple chart by putting stack panels on a canvas and then filling the stack panels with lables according to the data given.However I am not very happy with the performance.
If I change the stack panels with listboxes, and instead of lables add strings, would it be faster to render the data? The data I need to show is a subset from a large array of lists of strings. When I move the index, I have to clear all the listboxes and fill them with the new data. Or is there a faster way to do it?
All my strings are of 4 characters. Is it possible to change the orientation to vertical so that each listbox shows something like this
A
A
A
A
B
B
B
B
C
C
C
C
D
D
D
D
etc... The strings are AAAA, BBBB, CCCC, DDDD.
Upvotes: 0
Views: 2044
Reputation: 14256
I think you would want ItemsControl
, not ListBox
(no need for item selection).
The question is whether the overhead is worth it for you. ItemsControl
is more heavy weight than StackPanel
(as H.B. said, it often contains a StackPanel
). The reason to use an ItemsControl
would be UI virtualization. If many of the items are scrolling off of the screen, ItemsControl
will usually (not always, depends on the control template) only generate visuals for the ones that are on the screen. This saves a lot of processing time.
If you want raw speed, create a DrawingVisual
, call RenderOpen()
on this visual, use the DrawingContext
to draw the items and then display the DrawingVisual
inside of the Canvas
.
Upvotes: 1
Reputation: 184416
Just a few things you might want to keep in mind:
Upvotes: 1