Bug 21825 - Opacity limitations on iOS
Summary: Opacity limitations on iOS
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-05 11:25 UTC by Jon Douglas [MSFT]
Modified: 2015-02-03 05:55 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jon Douglas [MSFT] 2014-08-05 11:25:52 UTC
Testing opacity, it seems to work just fine for Android/iOS in the sense that 

Opacity = 0 - Completely hidden

Opacity = 1 - Completely visible

However if one wanted a percentage of Opacity such as

Opacity = .6 - Mainly visible

It seems to only work on Android, as iOS is always at Opacity = 1. I have tested this out further with my own sample, and it seems to be the case that only Android will function the expected way, where as iOS is either a Hidden/Visible type of this with Opacity.

Customer EX:

//BUTTON MAIN MENU

CustomButton btnMenu = new CustomButton

{

HeightRequest = 55,

WidthRequest = 40

};



Image imgMenu = new Image

{

HeightRequest = 55,

Source = ImageSource.FromFile("hamzur.png"),

VerticalOptions = LayoutOptions.Center

};





AbsoluteLayout boxMainMenu = new AbsoluteLayout

{

HeightRequest = 55,

Padding = new Thickness(0, 0, 0, 0),

HorizontalOptions = LayoutOptions.Start,

WidthRequest = 40,

Children = { imgMenu, btnMenu }

};

//-------//





//Use of Button//

public class CustomButton : Button

{





public event EventHandler TouchDown;

public event EventHandler TouchUp;

public event EventHandler ClickedButton;



public void SendTouchDown()

{

Opacity = 0.2;

var handler = TouchDown;

if (handler != null)

handler(this, EventArgs.Empty);

}



public void SendTouchUp()

{

Opacity = 0;

var handler = TouchUp;

if (handler != null)

handler(this, EventArgs.Empty);

}



public void SendClickedButton()

{

Opacity = 0;

var handler = ClickedButton;

if (handler != null)

handler(this, EventArgs.Empty);

}



public CustomButton()

{

BackgroundColor = Color.Gray;

Opacity = 0;

}

}
Comment 1 Arpit Jha 2014-08-26 06:56:27 UTC
I have checked this issue and able to reproduce it.

I have tried following steps to reduce it.
1.Create a Xamarin Forms Application.
2. Add a Myclass(.cs) .Did some code.
3.vary Label opacity to 0-1.
4.Run the application.

 public   class MyClass:ContentPage
    {

     public MyClass()
     {

         Grid grid = new Grid
         {
             VerticalOptions = LayoutOptions.Fill,
             HorizontalOptions = LayoutOptions.Fill,
             Padding = new Thickness(10),
             BackgroundColor = Color.Green,
             ColumnDefinitions =
            {
                  new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
                  new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
                  new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)}
            }
         };
         var stack = new StackLayout
         {
             Padding = new Thickness(5),
             Spacing = 5,
             Orientation = StackOrientation.Vertical,
             VerticalOptions = LayoutOptions.FillAndExpand,
             BackgroundColor = Color.White,
             Children =
    {
        
        new StackLayout
        {
            Padding = new Thickness(5),
            Orientation = StackOrientation.Vertical,
            VerticalOptions = LayoutOptions.FillAndExpand,
            BackgroundColor = Color.Blue.WithLuminosity(0.5),
            Children =
            {
                new Label
                {
                    Text = "Accounting, Finance and Management withconcentration on Analytical Consulting",
                    TextColor = Color.Black,
                    LineBreakMode = LineBreakMode.WordWrap,
                    Font = Font.SystemFontOfSize(16),
                    VerticalOptions = LayoutOptions.FillAndExpand
                }
            }
        }
        ,
        new Label
        {
            Text = "(Director)",
            TextColor = Color.Black,
            Font = Font.SystemFontOfSize(16),
            VerticalOptions = LayoutOptions.End,
            Opacity=1
        },

    }
         };


         grid.Children.Add(stack, 0, 0);
         Content = grid;





     }

    }



I observed that by varying of opacity (0 ,0.6,1) on android functioning properly and on  Ios does not show any change in output of opacity of label. Ios having always opacity at 1
Comment 2 Jason Smith [MSFT] 2015-02-03 05:55:38 UTC
Can no longer reproduce on 1.3.3-pre1