代码之家  ›  专栏  ›  技术社区  ›  Clifton Steenkamp

侧菜单边框Xamarin.iOS

  •  0
  • Clifton Steenkamp  · 技术社区  · 6 年前

    在我的xamarin.ios项目中,使用自定义渲染器来实现透明的主详细信息页后,我现在遇到的问题是,在实现此功能后,我注意到主详细信息页的外部有一个灰色边框,我尝试通过几个属性来访问它,但似乎都不起作用。

    以下是客户呈现程序代码

        public override void ViewWillLayoutSubviews()
        {
            base.ViewWillLayoutSubviews();
    
            var master = ViewControllers[0];
            master.View.BackgroundColor = UIColor.Clear;
            var detail = ViewController.ChildViewControllers[1];
        }
    

    下面是用于设计侧菜单的xaml代码:

    <?xml version="1.0" encoding="utf-8" ?>
    <MasterDetailPage
        x:Class="LoyaltyWorx.SideMenu"
        xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
         xmlns:fftransformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"
         xmlns:local="clr-namespace:LoyaltyWorx.MarkupExtensions; assembly=LoyalyWorx"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
        <MasterDetailPage.Master>
            <ContentPage Title="Menu" BackgroundColor="Transparent">
    
                <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"
                        Margin="0">
    
                        <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>
    </MasterDetailPage>

    请协助。

    0 回复  |  直到 6 年前