How to use a ListView in a ScrollView with XLabs-PopUp-Control?

2

Posts

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @AlessandroCaliaro: I don't have investigated this (maybe other solution) more in detail as my implemented solution (hide the main-SL, so that it don't receive tap's) works.
    Have a nice weekend...

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Thank @FredyWenger

  • batmacibatmaci DEMember ✭✭✭✭✭

    Is that already outdated? It looks like there is already autocomplete list from xlabs. by popup here is meant autocomplete list right?

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @batmac:
    No this has nothing to do with an "autocomplete list".
    The base problem is, that there are problems, to show a ListView in a ScrollView with XF (as both elements are scrollable).
    This thread shows, how to show an "scrolling" ListView in a (scrolling) ScrollView with a PopUp (from XLabs).

  • batmacibatmaci DEMember ✭✭✭✭✭

    Is it possible to implement this with MVVM? I tried evertyhing possible but cant figure out and i couldnt find any example.

  • batmacibatmaci DEMember ✭✭✭✭✭
    edited January 2016

    I had to change that to:
    _PopUpLayout.Content = GanzeSeite;
    Content = _PopUpLayout;
    So that the _PopUpLayout now is the top-layout / top View and the methods can be accessed over
    the _PopUpLayout-object, e.g.:
    _PopUpLayout.ShowPopUp // show a Popup
    _PopUpLayout.IsPopuiActive // check, if a Popup is active
    _PopUpLayout.DismissPopup // close a shown popup
    Now, we can define the actual Popup himself, e.g.:
    var PopUp = new StackLayout
    {
    WidthRequest = 400, // Important, the Popup hast to have a size to be showed
    HeightRequest = 400,
    BackgroundColor = Color.Black, // for Android and WP
    Orientation = StackOrientation.Vertical,
    Children =
    {
    PLZOrt_Label, // my Label on top
    SearchBarPLZOrt, // my SearchBar to the ListView
    LVPLZOrt, // The Listview (all Cities/Zip-Codes in the Datasurce -> List)
    }
    };

    If I understand correctly, var PopUp = new StackLayout this popup part can be done in the code only? or can I achieve it also on xaml? because If I add the stacklayout definition in the xaml, it is displayed not only in the popup.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @batmaci
    As I don't work with XAML (only with code), I can't say, if it is possible...
    But... I would do it (apply the PopUp) in code (should not be a great project)

  • batmacibatmaci DEMember ✭✭✭✭✭

    For the autocomplete list, did you use xlabs autocompleteview? if yes, how did you achieve it? there is website is awful, many code samples arent even tested and badly written. danke für deine Hilfe :)

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @batmaci:
    No, I don't have used the xlabs autocompleteview (I don't use autocomplete list's -> I use list's that are queried over a web-service to select some items to do a search laeter with the selected item).
    My problem was, to show a (scrolling) ListView in a (scrolling) ScrollView, what is not supported in XF.
    Therefore the PopUp is a good solution.
    And yes, their documentation is not very good (what is a pity).
    Especially the PopUp control is still not documented yet (even not showed under "Available controls" )
    Therefore, I have posted this thread and als wrote the example code to how to use it and how to install and use the Xlabs stuff in common.

  • batmacibatmaci DEMember ✭✭✭✭✭

    I have made this working fine on Androd and now I am trying to do the same on WP8.1 one but I am getting exception as below. Did you try it on WP8.1? Do you know how to resolve this issue?

    System.ArgumentException was unhandled by user code
      HResult=-2147024809
      Message=Value does not fall within the expected range.
      Source=Windows
      StackTrace:
           at Windows.UI.Xaml.Controls.Border.put_Child(UIElement value)
           at Xamarin.Forms.Platform.WinRT.FrameRenderer.PackChild()
           at Xamarin.Forms.Platform.WinRT.FrameRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
           at Xamarin.Forms.Platform.WinRT.VisualElementRenderer`2.SetElement(VisualElement element)
           at Xamarin.Forms.Platform.WinRT.Platform.CreateRenderer(VisualElement element)
           at Xamarin.Forms.Platform.WinRT.VisualElementPackager.OnChildAdded(Object sender, ElementEventArgs e)
           at Xamarin.Forms.Element.OnChildAdded(Element child)
           at Xamarin.Forms.VisualElement.OnChildAdded(Element child)
           at Xamarin.Forms.Layout`1.OnChildAdded(Element child)
           at Xamarin.Forms.Layout.OnInternalAdded(View view)
           at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
           at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
           at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
           at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
           at System.Collections.ObjectModel.Collection`1.Add(T item)
           at Xamarin.Forms.ObservableWrapper`2.Add(TRestrict item)
           at Xamarin.Forms.RelativeLayout.RelativeElementCollection.Add(View view, Constraint xConstraint, Constraint yConstraint, Constraint widthConstraint, Constraint heightConstraint)
           at XLabs.Forms.Controls.PopupLayout.ShowPopup(View popupView, Constraint xConstraint, Constraint yConstraint, Constraint widthConstraint, Constraint heightConstraint)
           at myApp.AppTemplatesPage.newAppClick(Object sender, EventArgs e)
           at Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked()
           at Xamarin.Forms.Platform.WinRT.ButtonRenderer.OnButtonClick(Object sender, RoutedEventArgs e)
      InnerException: 
    
  • batmacibatmaci DEMember ✭✭✭✭✭

    when I use frame as popup, It was crashing for me. I saw in your document that use stacklayout instead of frame in WP. It doesnt crash with SL but I have entry and button inside my popup and they are not usable. I cant enter any text into entry and I cant click the button. This is no problem on Android. I tried relativelayout and absolutelayout. they all had same issue. Do you know anything about this?

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @batmaci:
    No, I don't know anything about this.
    As I wrote, I had a problem with the frame in WP (but you have seen this already).
    I also have a button and an Entry on my SL and it works...
    But my app is based on something around Forms 1.4.4 and as you know, you have to fear new bugs with every new .Forms release...
    So... I can't really help you...

  • alessandrosuppiejalessandrosuppiej ITMember ✭✭

    this is not the first time i use popupLayout from XLabs.
    However today.... i am not able to make it work.

    ShowPopup Throws an exception : NullReference in Constraint.

    i have no costraints.... i have no relativeLayout ?

    can you help me?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Maybe you have upgraded XF and now it does not work?

  • XingHuanXingHuan USMember

    When button to show popup is clicked second time...the popup is not shown and throwing error in PopUpLayout.DismissPopup(); (Error: Cannot change ObservableCollection during a CollectionChanged Event) and causing app to crash....Is this a bug to be fixed in XF?

    Also I'm using the latest Nugget package of Xlabs.Forms. So anyone faced this problem before? If so what is the workaround??

  • XingHuanXingHuan USMember

    @FredyWenger Thanks for your Documentation, but I'm facing app crash when popup has to be shown second time. Also I'm not using Frames but normal stacklayout to show a listview inside popup and is crashing on both Android and iOS platforms.

    I'm attaching a screenshot of code and it is crashing in _PopUpLayout.DismissPopup().

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @XingHuan
    I'm still on .forms 1.4.4x (as normally every new version to XF breaks existing apps)

    But you use the ItemSelected-event, I use the ItemTapped-event.
    I know that I had some problems with the ItemSelected-event in the past.
    => So I would first try to use the temTapped-event instead of the ItemSelected-event

  • XingHuanXingHuan USMember

    @FredyWenger Using ItemTapped-event instead resolved the issue. Thanks a ton! :smile:

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @XingHuan:
    You're welcome..
    And... you should like postings that have helped you...

  • alessandrosuppiejalessandrosuppiej ITMember ✭✭

    i made the mistake to update to XF 2.x because i needed some fixes .
    However, meanwhile, i've found this plugin for popups.

    I think it's nice looking and more OOP oriented.

    https://github.com/rotorgames/Rg.Plugins.Popup

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @alessandrosuppiej
    Thanks für your posting here.
    Unfortunately, the plugin don't seems to work with WP yet ("coming soon"), so it can't be used from XF-uses that also target WP.
    Do you have implemented it and use it productive without any problem with the latest (2.1) XF-Version?

  • alessandrosuppiejalessandrosuppiej ITMember ✭✭

    @FredyWenger said:

    Do you have implemented it and use it productive without any problem with the latest (2.1) XF-Version?

    Yes i'm using 2.1.0.6526. it's so smooth and nice looking!

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @alessandrosuppiej
    Thanks for your feedback... so it may be an alternate to the XLabs PopUp as soon as also WP-support is implemented...

  • batmacibatmaci DEMember ✭✭✭✭✭

    @FredyWenger said:
    @batmaci:
    No, I don't know anything about this.
    As I wrote, I had a problem with the frame in WP (but you have seen this already).
    I also have a button and an Entry on my SL and it works...
    But my app is based on something around Forms 1.4.4 and as you know, you have to fear new bugs with every new .Forms release...
    So... I can't really help you...

    apparently looks like problem with the newer version of XF as people reported for ISO and WP here. It is totally frozen and not possible to click anything inside the popup.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @batmaci:
    So... it seems to be as I thought (new bugs in XF :disappointed:)
    I hope the new bugs will be fixed until I also have to update to a newer version (of cause a new OS version of iOS / Android / WP, that is not supported from my "old" 1.4.x XF version).

  • batmacibatmaci DEMember ✭✭✭✭✭

    @FredyWenger said:
    @alessandrosuppiej
    Thanks für your posting here.
    Unfortunately, the plugin don't seems to work with WP yet ("coming soon"), so it can't be used from XF-uses that also target WP.
    Do you have implemented it and use it productive without any problem with the latest (2.1) XF-Version?

    I have just implemented this popup plugin with latest XF version and removed Xlabs completely. Logic behind is different but it is much easier and faster to implement. Output is also tidier and looks much better. It works great on Android and IOS. for WP and Universal I need now another solution, probably a separate solution. WP should have it is own popup(not in XF), right? any suggestion for that will be appreciated.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @batmaci :
    Thanks for your posting here...

    WP should have it is own popup(not in XF), right?

    That, you should ask the owner of the package (coming soon... is ... when? :smirk:)

  • batmacibatmaci DEMember ✭✭✭✭✭

    @FredyWenger said:
    @batmaci :
    Thanks for your posting here...

    WP should have it is own popup(not in XF), right?

    That, you should ask the owner of the package (coming soon... is ... when? :smirk:)

    I meant that obviously there is no good solution for WPF and UWP in XF neither with Xlabs (for latest XF version) nor with this plugin. Therefore I thought to write native popup page right inside the WP project until they release something working for WP for XF as well. I need to see how difficult can it be.

  • Maharshi.5212Maharshi.5212 USMember ✭✭

    I dont like the popup control in xlabs popup . There is a discussion where i have uploaded my own popup. It works for android

  • Maharshi.5212Maharshi.5212 USMember ✭✭

    I have made my own radiobutton too with NControl. No need for XLabs radio control.

  • KirillLyubimov.5134KirillLyubimov.5134 RUMember ✭✭

    @FredyWenger

    https://github.com/rotorgames/Rg.Plugins.Popup

    Prerelease (1.0.0-pre1) already supports WinPhone and UWP.

    I would be glad if you accept participating in the beta testing.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @KirillLyubimov.5134
    Thanks for your proposal.
    I have my app (based on .forms 1.4x) already in all stores since a few months fortunately.
    For a new customer-project (that I have to start in the near time), I have decided to use only Xamarin.Android (of cause the many, many bugs and especially new bugs after every release, what ist not acceptable for real busines projects).
    I think, I also should be able to use your plugin in plain Xamarin.Android without problems?
    If yes, I want to give it a try, as soon as I have the need for a PopUp in the new Android app.

  • KirillLyubimov.5134KirillLyubimov.5134 RUMember ✭✭

    @FredyWenger The plugin works only with Xamarin Forms. The plugin will not install if not installed Xamarin Forms.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @KirillLyubimov.5134
    Thanks for the information...
    So... I'm - unfortunately - not able to do a beta-test yet (maybe later, if I have to implement some changes in my already existing .forms app) :sunglasses:

  • parth7676parth7676 USMember ✭✭

    @FredyWenger Can you provide a better example for Popup.I am bit confused with this lines from pdf

    Content = GanzeSeite;
    _PopUpLayout.Content = GanzeSeite;
    Content = _PopUpLayout;

    According to my understanding, you have created a stack layout that will be shown in the popup and then assign it to the popup layout content, then you have assigned the popup to the content of the content page. Am I right??

    According to my understanding, I have implemented it , but when i try to navigate to the page where popup is implemented it directly show popup content instead of that page.Plz help!!

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @parth7676:
    The _PopUpLayout has to be the top layout.

    This code-lines only do exactly this (nothing magic here....)
    "GanzeSeite" holds the whole (in code generated) content.
    The content to the _PopUpLayout is set to the GanzeSeite (that holds the whole content)
    The Content of the page ist set to PopUpLayout
    So the _PopUpLayout becomes the top layout and holds GanzeSeite (with the whole content)

    Hope this explains and helps...

  • BreadAVEIBreadAVEI USMember

    Fredy Wenger,
    thank you for your nice document, it helped me a lot to start with the popuplayout.
    I got the popup show up correctly in my app, but the control in popuplayout are not clickable at all in IOS, but Android version works fine.

    It doesn't matter whether I hide the original content in the page or not, click the button on popuplayout nothing happened.
    But in android, click the button will show a alert as I expected.

    I used XMAL and the contents of the popup is created in another xaml as StackLayout.
    I am using Xamarin.Forms 2.1.0.6526 and XLabs.Forms 2.0.5782

    Do I miss anything here?

    Thank you!

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @BreadAvei:

    My app is based on .forms 1.4.x (I don't have updated it in the last time as there was no need to do it).
    I also don't work with xaml.
    But... have you took care, that the PopUp-Layout is the top layout...?
    The code that does this:

    Content = GanzeSeite;
     _PopUpLayout.Content = GanzeSeite;
     Content = _PopUpLayout;
    
  • BreadAVEIBreadAVEI USMember

    @FredyWenger

    Yes, the popup layout is the top layout, someone was saying that the popup layout doesn't work on IOS.
    Mine works on Android.

Sign In or Register to comment.