How to implement page loader in nativescript-vue? - nativescript

How can we implement page loader??
Can anybody show me detail code...
<ActivityIndicator :busy="showLogin" :visibility="showLogin ? 'visible' : 'collapse'" height="50" width="50"/>
this.showLogin = this.showLogin==false?true:false;

If you want to show just an ActivityIndicator, bind the busy attribute to a variable, toggle it whenever you want to show or hide.
Or if you want to block the page entire page completely, try nativescript-loading-indicator plugin.

Related

Cancelcommand is not working in sfdatepicker in xamarin forms

I want normal cancel functionality on cancel button click of sfdatepicker footer, I am trying to achieve it by binding command but it is not working. Could any one suggest me any solution for that ?
You can use code like below:
<datePicker:SfDatePicker.FooterView>
<Grid>
<Button Text="Ok"
x:Name="footerViewButton"
Clicked="footerViewButton_Clicked"/>
</Grid>
</datePicker:SfDatePicker.FooterView>
Created in this way, and then create the corresponding method in the ViewModel to achieve logical operations.

Nativescript load tabs only when displayed

I have setup a custom tab layout defines as following :
main.xml
<StackLayout id="sl_main">
<t1:explore id="tab_explore" visibility="{{ currentActive == 'explore' ? 'visible' : 'collapsed' }}" />
<t2:community id="tab_community" visibility="{{ currentActive == 'community' ? 'visible' : 'collapsed' }}"/>
<t3:profile id="tab_profile" visibility="{{ currentActive == 'profile' ? 'visible' : 'collapsed' }}" />
</StackLayout>
Since all of these tabs are doing cpu intensive operations - such as downloading and uploading images - , I would like for each tab to be loaded only when it is actually displayed (which happens when it's visibility attribute switches from collapsed to visible)
EDIT
Basically right now when I navigate to main.js all the tabs loaded events get called.
So when I navigate to main I have 3 cpu intensive functions all running one after the other. ( tab_explore.loaded , tab_community.loaded , tab_profile.loaded ) What I would like is that if the visible tab is tab_explore I only call its loaded function. Than when tab_profile becomes visible I load that function etc.
How would you achieve that?
Based on your example the visibility flag is only a visual state (hidden or not). The view is still loaded to memory and is active in the background.
Perhaps your tab-select logic should add/remove the partial-views from the container? Instead of just hiding/showing them?
This way the unloaded/loaded events for each view would fire every time you select the proper tab.

How to add a button to first item in ListView

Greeting,
I'm developing an apps for Windows Phone 8.1 and face some problem with ListView.
I wanted to place a button for the FIRST item in ListView, but it seem like I can't align center the button.
Below is the code I use currently:
<ListView>
<Button Content="Jio!" Height="6" Width="362"/>
<ListViewItem Content="ListViewItem"/>
</ListView>
Adding horizontalalignment='center' just wont work for the button.
The reason I want to do this is because I wanted the button to scroll together with the list, hence I'm placing it inside the ListView.
Please advice what can I do to achieve my purpose, thanks!
I recommend using the ListView.Header content to place such a button instead of adding it as a child directly.
<ListView>
<ListView.Header>
<Button ... HorizontalAlignment="Center" />
</ListView.Header>
</ListView>
By default, the ListViewItems are left-aligned. You will eventually have to replace their Template in order to center-align it (HeaderTemplate Property).

How to show progress bar while loading a page

I have a page in my windows phone 8 app, which takes 1-3 seconds to load.
I use this statement to load the page
NavigationService.Navigate(new Uri("/sleep_main.xaml", UriKind.Relative));
I want to display a progressbar of any type while my page loads.
Plz help how to to do this.
Use this code in your page:
<ProgressBar IsIndeterminate="true" />
You can set parameters for this control.
Let see this link: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.controls.progressbar(v=vs.105).aspx

Change Content of a ListFooterTemplate of LongListSelector

Follow -up to the answer of this question :Add a Load More Button at the end of ListBox without losing Virtualization?
With this example :
<toolkit:LongListSelector ItemsSource="{Binding Items}">
<toolkit:LongListSelector.ListFooter>
<Grid>
<Button x:Name="btnReadMore" Content="ReadMore"/>
</Grid>
</toolkit:LongListSelector.ListFooter>
Is there a way to change his Content by the C# ? (= "ReadMore" and when the itemsource=0 "go back") thank you !
You can bind the value of the Content property to some ViewModel property. This is the best way IMHO:
You would also bind the Command property to some ViewModel command and this will ensure that you correctly set the caption and handle the result.
But beware, you are not supposed to have a button saying "Go Back" which, when pressed, acts as a hardware back button. You are not supposed to emulate such system functionality.

Resources