Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Weird bug - interaction between BackgroundColor and InputTransparent

$
0
0

I'll raise this as a bug in Bugzilla, but just in case anybody is struggling with scrolling on WindowsPhone, it seems that there is an interaction between BackgroundColor and InputTransparent. Using the code below, if the user tries scrolling up or down by touching the one-unit high separator lines, the scrolling does NOT happen on Windows Phone (I am using a physical Nokia device). However, uncomment the lines that set BackgroundColor, and suddenly scrolling does work. Possibly the weirdest interaction I've seen so far...

using Xamarin.Forms;

namespace XamarinBug_BoxViewInputTransparent
{
public class App : Application
{
public App()
{
// The root page of your application
MainPage = new ContentPage
{
Content = new ScrollView
{
Orientation = ScrollOrientation.Vertical,
Content = new StackLayout
{
InputTransparent = true,
Orientation = StackOrientation.Vertical,
Padding = Device.OnPlatform(new Thickness(5, 20, 5, 5), new Thickness(5, 0, 5, 5), new Thickness(5, 0, 5, 5)),
Spacing = 0.0,
VerticalOptions = LayoutOptions.Fill,
Children =
{
new Label
{
FontAttributes = FontAttributes.Bold,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
LineBreakMode = LineBreakMode.WordWrap,
Text = "Some text here to give some space between the separators.",
TextColor = Color.Accent,
YAlign = TextAlignment.Center
},
new StackLayout
{
// BackgroundColor = Color.White,
InputTransparent = true,
Orientation = StackOrientation.Vertical,
Padding = new Thickness(0, 40, 0, 40),
Children =
{
new BoxView
{
Color = Color.Accent,
HeightRequest = 1,
HorizontalOptions = LayoutOptions.FillAndExpand,
InputTransparent = true,
VerticalOptions = LayoutOptions.Center
}
}
},
new Label
{
FontAttributes = FontAttributes.Bold,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
LineBreakMode = LineBreakMode.WordWrap,
Text = "Some text here to give some space between the separators.",
TextColor = Color.Accent,
YAlign = TextAlignment.Center
},
new StackLayout
{
// BackgroundColor = Color.Gray,
InputTransparent = true,
Orientation = StackOrientation.Vertical,
Padding = new Thickness(0, 40, 0, 40),
Children =
{
new BoxView
{
Color = Color.Accent,
HeightRequest = 1,
HorizontalOptions = LayoutOptions.FillAndExpand,
InputTransparent = true,
VerticalOptions = LayoutOptions.Center
}
}
},
new Label
{
FontAttributes = FontAttributes.Bold,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
LineBreakMode = LineBreakMode.WordWrap,
Text = "Some text here to give some space between the separators.",
TextColor = Color.Accent,
YAlign = TextAlignment.Center
},
new StackLayout
{
// BackgroundColor = Color.White,
InputTransparent = true,
Orientation = StackOrientation.Vertical,
Padding = new Thickness(0, 40, 0, 40),
Children =
{
new BoxView
{
Color = Color.Accent,
HeightRequest = 1,
HorizontalOptions = LayoutOptions.FillAndExpand,
InputTransparent = true,
VerticalOptions = LayoutOptions.Center
}
}
},
new StackLayout
{
// BackgroundColor = Color.Gray,
InputTransparent = true,
Orientation = StackOrientation.Vertical,
Padding = new Thickness(0, 40, 0, 40),
Children =
{
new BoxView
{
Color = Color.Accent,
HeightRequest = 700,
HorizontalOptions = LayoutOptions.FillAndExpand,
InputTransparent = true,
VerticalOptions = LayoutOptions.Center
}
}
}
}
}
}
};
}

    protected override void OnStart()
    {
        // Handle when your app starts
    }

    protected override void OnSleep()
    {
        // Handle when your app sleeps
    }

    protected override void OnResume()
    {
        // Handle when your app resumes
    }
}

}


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>