-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ListView: disable animation when selectedItem changes #9
Comments
@nghia-bui just to be clear - you don't want to be able to highlight any row in the list? Or better would be if you have a example app where I can check this directly. If it is the case you can do the following:
type MyListViewRenderer() =
inherit ListViewRenderer()
override this.OnElementPropertyChanged(sender: obj, e: PropertyChangedEventArgs) =
base.OnElementPropertyChanged(sender, e)
match e.PropertyName with
| "SelectedItem" ->
match this.Element, this.Control with
| null, null -> ()
| _ ->
this.Control.VisibleCells
|> Array.iter (fun v -> v.SelectionStyle <- UITableViewCellSelectionStyle.None )
| _ -> ()
[<assembly: ExportRenderer(typeof<Fabulous.XamarinForms.CustomListView>, typeof<MyListViewRenderer>)>] This way the renderer is going to work for every If you only want to modify one specific ListView then you need to create your own type as follows: module TestListViewModule =
type TLV() = inherit CustomListView()
type Fabulous.XamarinForms.View with
static member inline TestListView(?items: ViewElement list, ?itemAppearing: int -> unit, ?itemSelected: int option -> unit) =
let attribCount = 0
let attribs = ViewBuilders.BuildListView(attribCount, ?items=items, ?itemAppearing=itemAppearing, ?itemSelected=itemSelected)
let update (prevOpt: ViewElement voption) (source: ViewElement) (target: TLV) =
ViewBuilders.UpdateListView(prevOpt, source, target)
let updateAttachedProperties propertyKey prevOpt source targetChild =
ViewBuilders.UpdateListViewAttachedProperties(propertyKey, prevOpt, source, targetChild)
ViewElement.Create<TLV>(TLV, update, updateAttachedProperties, attribs) And to make it work for this specific type you have to change the export part. [<assembly: ExportRenderer(typeof<AllControls.Samples.TestListViewModule.TLV>, typeof<MyListViewRenderer>)>] |
I have a ListView like this:
Problem is that the items (with new content) are shown immediately in the UI, but the selected item is highlighted a little bit late due to the animation.
How to disable this animation?
The text was updated successfully, but these errors were encountered: