Update content in scrollable area

I want to present content in a scrollable area.

So I created a Container Control and put a Canvas in it.
In the view I put a ScrollableArea and defined its content as the Container Control.

But I can’t see how I can force the canvas to be redrawn when the content has changed.



I want to force the redrawn from the view.

If I do ContainerControl.invalidate I get a compiler error.
If I do ScrollableArea1.invalidate, nothing happens.

Your question was :

Have you tried invalidating the canvas ?

Yes, but from the view it is not possible.

Uh ? Why ?

The canvas is in the container control. On the view I have the scrollable area with the content set to the container control which holds the canvas. In the canvas I show information based on a action in the view. The canvas shows information stored in a global variable. When this information changes, I want the canvas to be redrawn. But how can this be achieved?

You need to have a reference to what you want to call.

iOSScrollableArea has a Content property that you set to the ContainerControl you are using. So in your view, you would access this property, cast it to the Container and then you can get at what you need.

For example:

[code] // Get container
Dim cc As ContainerControl1
cc = ContainerControl1(ScrollableArea1.Content)

// Get Canvas on container (must have Public scope)
Dim canvas As iOSCanvas
canvas = cc.Canvas1

I think a better design would be to put your own “Refresh” method on the container and call that instead:

Public Sub Refresh() Canvas1.Invalidate End Sub

You can then call it similar as above:

// Get container Dim cc As ContainerControl1 cc = ContainerControl1(ScrollableArea1.Content) cc.Refresh

Thank you Paul.
You helped me again.