Как придать эффект тени кадру в формах xamarin - PullRequest
0 голосов
/ 23 июня 2018

Я новичок в xamarin. Я хочу добавить эффект тени к своему фрейму и избежать верхней границы моего фрейма, я пробовал свойство hasShadow фрейма, но это мне не помогает.Как я могу это сделать.

Пожалуйста, помогите мне

Вот мой Xaml

 <ListView x:Name="lv_search" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" RowHeight="105" ItemTapped="lv_search_ItemTapped"
                          SeparatorColor="White" BackgroundColor="Black" Margin="0,15,0,0">
                    <ListView.ItemTemplate>
                      <DataTemplate>
                        <ViewCell>
                          <Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="White">
                            <Grid Margin="20,10,0,10" BackgroundColor="White">
                              <Frame  BackgroundColor="White" >
                                <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
                                  <StackLayout Orientation="Horizontal" HorizontalOptions="StartAndExpand" VerticalOptions="FillAndExpand" Margin="0,0,10,0">
                                    <AbsoluteLayout  HorizontalOptions="StartAndExpand">
                                      <Image Source="ellipse_1" VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand"
                                         AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.01,0.4,1,1" BackgroundColor="White"/>
                                         <Image Source="{Binding Image}" AbsoluteLayout.LayoutBounds="0.02,0.4,1,1" AbsoluteLayout.LayoutFlags="All"
                                           HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"  />
                                    </AbsoluteLayout>

                                    <StackLayout AbsoluteLayout.LayoutBounds="0.035,0.5,1,1" AbsoluteLayout.LayoutFlags="All" Orientation="Horizontal"
                                      HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand">
                                      <Label x:Name="lbl_categories" HorizontalOptions="StartAndExpand" VerticalOptions="CenterAndExpand" 
                                        Margin="10,0,0,0" FontFamily="Proxima-Nova-Semibold"  TextColor="#222222"  Text="{Binding Title}" 
                                        LineBreakMode="WordWrap"  HorizontalTextAlignment="Start" FontSize="17.3" FontAttributes="Bold"/>
                                    </StackLayout>
                                    </StackLayout>
                                     <Image HorizontalOptions="EndAndExpand" VerticalOptions="Center" Source="arrow"  
                                       AbsoluteLayout.LayoutBounds="0.9,0.3,0,0.3" AbsoluteLayout.LayoutFlags="All" />
                                 </StackLayout>
                               </Frame>
                          </Grid>
                           <Image Source="img_frm" Margin="15,0,0,0" AbsoluteLayout.LayoutBounds="1,0.5,1,1" HorizontalOptions="StartAndExpand"
                            AbsoluteLayout.LayoutFlags="All"/>
                       </Grid>
                    </ViewCell>
                  </DataTemplate>
                </ListView.ItemTemplate>
             </ListView>

Код дает этот вывод

enter image description here

Но мне нужна такая страница enter image description here

Разница страниц отмечена синими чернилами.

1 Ответ

0 голосов
/ 24 июня 2018

Эта статья Алекса Данна выглядит именно так, как вы хотите: enter image description here https://alexdunn.org/2018/06/06/xamarin-tip-dynamic-elevation-frames/

Обратите внимание, что вы можете контролировать высоту столько, сколько хотите

...