I am having an issue with loading ViewCell in ListView in Xamarin.Forms application.
ViewCell is displayed correctly but only half of it. I tried to scroll down but I couldn't. The ListView ends loading but the ViewCell is designed to continue.
Thank you for your answers !
Take a look on ListView.HasUnevenRows Property:
To automatically size row height to fit content, the developer first
sets the HasUnevenRows property to true; and, second, either leaves
RowHeight at its default value of -1, or sets it to -1 if it has been
changed.
source
More details in official documentation.
Related
I want to push (make visible) little part of master page to detail page like on pictures in links below. Is it possible in Xamarin.Forms?
Before swipe
After swipe
I'll be grateful for help.
Set
<ContentPage NavigationPage.HasNavigationBar="False">
Place a StackLayout or Grid that looks like the side menu shown in your image. Add a tap gesture recognizer to it.
slMenu.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(() => ShowSideMenu(masterPage)),
});
private void ShowSideMenu(MasterDetailPage masterPage)
{
masterPage.IsPresented = !masterPage.IsPresented;
}
This is possible, but requires quite some work, since you can't access the width of the MasterDetailView directly.
In another post (see How to set width for MasterDetailPage in xamarin forms ) I have described how to change the width of the MasterDetail view.
While implementing that, I came across a behaviour like you want to have, though for me it was an error.
Basically the steps would be
Implement a custom version of the MasterDetail view where you can set up a custom width
Change the width of the master view so it is a bit wider than it should be
Adapt the calculations when collapsing and expanding the view so that they don't collapse the entire width
For instance if your Master View gets a width of 340 and you want the last 40 to show, make sure that when being collapsed it "only" moves by 300
I really need your help.
I'm new at developing Xamarin.iOS apps and now I'm totally stuck.
I cannot get the hang of how to implement a dynamic ScrollView in iOS, it was fairly easy to implement on Android.
So what I'm trying to implement is a view that contains mostly text (that will be quite long, hence the scrolling, but also two buttons.
Here is a gif in Android showing what I'm trying to achieve
The view is like this:
Header
Long text
Copyright button
-- Copyright text
Terms of usage button
-- Terms of usage text
I have struggled with the scrolling so long and I really need your help.
All of the text properties are getting bound to the view by binding with MvvmCross so the view can't be with hard-coded heights and widths, it needs to adjust properly.
Can somebody please show me with a sample project how to implement it?
The view needs to be in a .xib view (because of MvvmCross) and it cannot contain a UIViewcontroller.
So the solution needs to be in a simple UIView
I'm working on a Windows, with Visual Studio 2015 enterprise, and I cannot use a Mac (and Xcode) other than to compile my code with.
What I've tried is a solution like this:
UIView called "MyRootview"
-- UIScrollView called "MyScrollView"
-- -- UIView called "MyContentView"
Can you please help me?
Method 1:
Use a TableView instead of ScrollView. Make the header row 1, long text row 2, button 1 and it's text row 3 and button 4 and it's text row 4.
Give row height for the last 2 rows so that you only see the button and on button click increase the row height and reload the table section.
Method 2:
If you keep wanna using ScrollView, put the button data in a label and give it a height of 0 (and number of lines 1) to hide it and on button click remove the height constraint and set the number of lines to 0 (max).
I used FluentLayout instead. Very easy.
https://github.com/FluentLayout/Cirrious.FluentLayout
My layout has severalsliders in a scroll view which scrolls horizontally. The issue is when I try to drag the slider thumb it is not moving instead the scroll view itself scrolls horizontally. How to fix this? (In Swift)
Swift 3 Solution
I was facing a similar issue and fixed it by setting
scrollView.delaysContentTouches = false
Explanation
According to Apple Docs
If the value of this property (delaysContentTouches) is true, the scroll view delays handling the touch-down gesture until it can determine if scrolling is the intent. If the value is false , the scroll view immediately calls touchesShouldBegin(_:with:in:)
. The default value is true.
As the word suggests it delays the content touch (i.e lowers the priority of subview's action) leading to irresponsive subview content updation during scrolling.
When this property is set to false it gives priority to the subview's action (by immediately calling touchesShouldBegin(_:with:in:)) leading to responsive subview content updation.
Maybe you call UISlider "Lazy var". Let's change it to "Let"
I have a ContentView with a StackLayout with multiple children sized to the full width of the screen. In other words, if the screen width is 320 and I have five children, the inner StackLayout is resized to 1600.
In this ContentView, I have Next and Previous buttons that when clicked, animate the inner StackLayout's TranslateX property. Basically, I'm creating a carousel by translating the StackLayout within the ContentView. I chose this route because I was having layout issues using a ScrollView and a custom renderer when I would modify that layout of the view (by hiding labels, etc.)
However, I've hit a snag. Content that appears after I set the TranslateX property doesn't receive any tap events. I believe I might have to reset some tappable area, but I'm not even sure where to begin with that. Does anyone have any suggestions?
I posted this same question in Xamarin's Forums, and someone there answered. For anyone looking, the answer is here: https://forums.xamarin.com/discussion/comment/142914/#Comment_142914
If that link stops working at some point in the future for some reason, the relevant answer is:
Hit testing is done based on the actual frame of the control determined by layout, but translation happens after layout. Therefore hit testing does not take translation into account. If you want a view to be touchable then you should update its layout directly rather than using translation.
I have a xamarin forms page with a listview and a picker. On the changed event of the picker, I populate the listview. On Windows phone, intermittently, I get this exception:
System.Windows.LayoutCycleException: Layout cycle detected. Layout could not complete
Sounds like a timeout issue due to the number of items set in the ItemSource.
I would explicitly set the height value of the ViewCell and the Children of that view cell so that Windows Phone doesn't try to calculate the height for every item
See this Xamarin Forum post for more info:
https://forums.xamarin.com/discussion/41813/layout-cycle-detected-layout-could-not-complete-after-resetting-listview-itemssource