Xamarin Forms - Refresh a content page

Hi!

On Xamarin Forms, considering a ContentPage with a refresh button on a toolbar, what should I do on the clicked event (OnToolbarItemClicked) to refresh all the content?

<ContentPage.ToolbarItems>
        <ToolbarItem Text="Refresh"
                 Order="Primary"
                 Clicked="OnToolbarItemClicked">
            <ToolbarItem.Icon>
                <OnPlatform x:TypeArguments="FileImageSource"
                             iOS="refresh_24x24.png"
                             Android="ic_action_refresh.png" />
            </ToolbarItem.Icon>
         </ToolbarItem>
 </ContentPage.ToolbarItems>

Thanks,
Daniel

Tagged:

Best Answer

Answers

  • LeeOlsen.5615LeeOlsen.5615 USUniversity ✭✭

    I'm not sure what exactly you are trying to refresh but if you are using DataBinding (which you should be), just refresh the databound objects and the UI will reflect that on it's own.

  • DanielBarrrosAmorimDanielBarrrosAmorim BRUniversity ✭✭

    @LeeOlsen.3738 Thanks for your answer. I have a ContentPage with a webview and tableview getting data from a Http Client connection (Web API) through a ModelView class.

    Could you give me an example of your idea?

    Thank you!
    Daniel

  • DanielBarrrosAmorimDanielBarrrosAmorim BRUniversity ✭✭

    Hi @LeeOlsen.3738 ,

    I am sorry for my late reply, but your answer was great!

    Thank you very much!

    Daniel

Sign In or Register to comment.