RadListView combined Swipe & Click (Press) - nativescript

I work with RadListView.
There is way to combien Click and Swipe actions ? if I set swipeActions="true" and selectionBehavior="Press" the Press event will be fired first .. The problem is I use the Press event to navigate and the navigation start on swiping !
I think there is way to achieve this on checking if swipe being to start, then disable Press event .. and when itemSwipeProgressEnded event is fired re bind Press event !!
But I hop there is way more cool to achieve to same result ?
<lv:RadListView
id="listView"
items="{{ dataItems }}"
row="1"
selectionBehavior="Press"
itemSelecting="{{ itemSelected }}"
itemSwipeProgressEnded="onSwipeCellFinished"
itemSwipeProgressStarted="onSwipeCellStarted"
itemSwipeProgressChanged="onCellSwiping"
multipleSelection="false"
swipeActions="true">

Related

Nativescript listview infinite scrolling

I want to implement in my Listview component infinite scroll with the loading indicator.
Need code for native-script vue and I don't want to use RadListView.
Use loadMoreItems event which should be triggered when you reach end of list view, hit your API & add more items in the event.

Can multiple BlueprintJS Popovers have the same target? (e.g. one for click and another for hover)

Let's say I have a Button component, and I'd like Popover A to appear upon hovering over the Button, and Popover B to appear when clicking on the button. Is this possible?
You can do this by nesting the popovers like this:
<Popover content={<div>Hover</div>} interactionKind={PopoverInteractionKind.HOVER}>
<Popover content={<div>Click</div>} interactionKind={PopoverInteractionKind.CLICK}>
<Button text="Button with two popovers"/>
</Popover>
</Popover>
There's a working example here.
In the case you don't want the hover popover to appear whenever a user clicks on the button, you can achieve this by switching to controlled usage by setting the isOpen prop. See the BP docs for more info on this.

Nativescript Tabview bug when switching between tabs

I've got a tabview with 3 tabs. In the last tab, I've got a BUTTON with tap="{{ myTapEvent }}" set. I get the callback when I tap.
The problem is that if I switch to another tab (e.g. tab #1) and then back to tab #3 and tap on the BUTTON - I get 2 callbacks.
Switch between the tabs N times - when I tap on the BUTTON , I get N callbacks.
So looks like the event is being registered everytime the tab is selected but not being deregistered on selecting another tab.
If this is not the proper place, where do I report this bug.
Operator error!
I had the following:
<Button text="{{ to_date }}" onTap="{{ onDateTap }}"/>
The attribute for tap event was onTap instead of tap.
It does work - but causes the multiple callbacks.

WP7 Listbox - clearing selected item

I am using a listbox in a data template - and from an earlier post I cannot reference the listbox directly in the code behind.
As a result I am capturing the last selected object in the selectionchanged event for the listbox and using this when I want to navigate.
I now need to also clear the selected object in the listbox -can I do this in the selectionchanged event (after storing it away).
Alternatively I could use the MouseLeftButtonDown event on the listbox (which I understand is the equivalent of a 'click') but can I get the selected object in the listbox in this event.
thanks
In the selection changed event set <ListboxName>.SelectedIndex = -1;
Also, do not use the MouseLeftButtonDown event. This will fire whenever the user touches the ListBox, even if they're just trying to scroll up / down and not actually selecting an item.
If you can't change the SelectedIndex in code behind then, instead of detecting the SelectionChanged event you could detect a Tap event on the ListBoxItem.

ListBox SelectedIndex is always -1

I have a Listbox with Button and Textblock as ItemTemplate. Button has an onClick event.
All i want is to get the index of the clicked item, but SelectedIndex property in my ListBox is always -1!
How can I get the index of the clicked item?
The problem is that the Button control is swallowing the mouse events to provide the Click behavior, so the ListBox never receives any events to tell it that the selection has changed.
As #Alexander suggests, you could use an MVVM-style approach with commands to handle the action in a view model and pass the data context as the parameter.
Alternatively, you could replace the Button with any other layout control and either use the gesture service from the Silverlight Toolkit or use the regular MouseLeftButtonUp event. In either instance, the mouse events will bubble up and enable the ListBox to handle selection.
You might want to actually select something in your listbox then :p
If you want to get data object associated with current ListItem use RouteCommand. Here is example
<ListView.ItemTemplate>
<DataTemplate>
<Button Margin="5,0" Command="{StaticResource ButtonCommand}"
CommandParameter="{Binding}">
</DataTemplate>
<ListView.ItemTemplate>
You need also define Command at least in ListView.Resources
<RoutedCommand x:Key="ButtonCommand"/>
And then setup CommandBinding like this
<ListView.CommandBindings>
<CommandBinding Command="{StaticResource ButtonCommand}" Executed="Button_Click"/>
</ListView.CommandBindings>
In the end write handler
Button_Click(object sender, ExecutedRoutedEventArgs e)
{
e.Parameter// object that you Specified in CommandParameter
}
In advance you can use any MVVM framework, define all command and commands logic in model and then just bind this commands to corresponding elements.

Resources