Transparency not rendering the same on ios

CliftonSteenkampCliftonSteenkamp USMember ✭✭
edited July 2018 in Xamarin.iOS

Hi

I just can't understand why the background for my side menu on xamarin forms won't render the same on my xamarin.ios. Yet in other parts of the project my list views render and look the same when I use transparent backgrounds, I even tried copying and pasting the xaml code from other parts of the project where it does render the same, but still it does not work. In case anyone's wondering the side menu on ios was requested by the client.

Attached below I have 2 images showing how the side menu renders differently on the 2 platforms

Here's the Xaml code I'm using for my Side Menu:

`

<MasterDetailPage.Master>

        <StackLayout Orientation="Vertical" BackgroundColor="Transparent" Spacing="0">
            <StackLayout
                HorizontalOptions="Fill"
                Orientation="Horizontal"
                VerticalOptions="Fill" BackgroundColor="Black" Padding="50, 50, 50, 50">
                <StackLayout HorizontalOptions="Center" Orientation="Vertical">
                    <ffimageloading:CachedImage x:Name="ProfilePictureCircleImage" 
                                                LoadingPlaceholder="profile_image_placeholder.png" 
                                                ErrorPlaceholder="profile_image_placeholder.png" 
                                                DownsampleToViewSize="true"
                                                FadeAnimationEnabled="true"
                                                HeightRequest="65"
                                                WidthRequest="65">
                <ffimageloading:CachedImage.Transformations>
                    <fftransformations:CircleTransformation/>
                </ffimageloading:CachedImage.Transformations>
                     </ffimageloading:CachedImage>
                </StackLayout>
                <StackLayout
                    HorizontalOptions="CenterAndExpand"
                    Orientation="Vertical"
                    VerticalOptions="CenterAndExpand">
                    <Label
                        x:Name="FullNameLabel"
                        FontSize="18"
                        HorizontalOptions="Center"
                        TextColor="White"
                        VerticalOptions="CenterAndExpand" />
                </StackLayout>
            </StackLayout>
    <BoxView HeightRequest="2" BackgroundColor="#D90B31"/>

         <ListView
                x:Name="NavigationMenuItems"
                ItemSelected="OnMenuItemSelected"
                BackgroundColor="{StaticResource TileColour}"
                RowHeight="60"
                SeparatorVisibility="None"
                SeparatorColor="Transparent">

                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <!--  Main design for menu items  -->


                            <StackLayout
                                Padding="20,10,0,10"
                                Orientation="Horizontal"
                                Spacing="20"
                                VerticalOptions="FillAndExpand"
                                BackgroundColor="Transparent">


           <local:TintedCachedImage TintColor="{StaticResource SideMenuIconColor}" 
                                    Source="{Binding Icon}" 
                                    VerticalOptions="Center"
                                    DownsampleToViewSize="true"
                                    HeightRequest="19" 
                                    WidthRequest="19"/>
                                <Label
                                    FontSize="15"
                                    Text="{Binding Title}"
                                    TextColor="{StaticResource SideMenuTextColor}"
                                    VerticalOptions="Center" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage>
</MasterDetailPage.Master>

<MasterDetailPage.Detail>
    <NavigationPage />
</MasterDetailPage.Detail>


`

Best Answer

Answers

  • CliftonSteenkampCliftonSteenkamp USMember ✭✭
    edited August 2018

    I should posted this earlier, but I actually found a solution to my problem

    public class CustomSideMenuRenderer: TabletMasterDetailRenderer
        {
            public override void ViewWillLayoutSubviews()
            {
                base.ViewWillLayoutSubviews();
    
                var master = ViewControllers[0];
                master.View.BackgroundColor = UIColor.Clear;
                var detail = ViewController.ChildViewControllers[1];
    
            }
        }
    
Sign In or Register to comment.