以Xamarin形式扩展ListView

时间:2019-03-27 19:09:33

标签: xamarin xamarin.forms

嗨,我正在Xamarin Forms中创建一个扩展的ListView。我拍了两行网格。第一高度为50 ..,第二高度为AUTO ...当我单击第一行并使下面的行可见时。下面的行变为可见,但单元格的高度保持不变。.我也将ListView行设置为不均匀。.请在下面找到代码

 <localRenderer:NativeListView x:Name="SkillsListView"
                              HasUnevenRows="true" 
                              AbsoluteLayout.LayoutFlags="All"
                               AbsoluteLayout.LayoutBounds="0,0,1,1"
                              Margin="5,5,5,5"
            SelectionMode="None"
                 BackgroundColor="#F3F4F6" 

                  SeparatorVisibility="None"
                              >
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>

                        <Grid 
                                     HorizontalOptions="FillAndExpand"
                                     VerticalOptions="FillAndExpand"
                                     Padding="0">

                            <Grid.RowDefinitions>

                             <RowDefinition Height="50"/>
                                 <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>


                             <AbsoluteLayout HorizontalOptions="FillAndExpand" 
                                                    VerticalOptions="Fill" 
                                                    HeightRequest="50" 
                                             Grid.Row="0"
                                                    BackgroundColor="#F3F4F5">
                                        <AbsoluteLayout Margin="5,5,5,5" AbsoluteLayout.LayoutFlags="All"
                                                        AbsoluteLayout.LayoutBounds="0,0,1,1" 
                                                        BackgroundColor="#FCFCFD">

                                            <Label Text="{Binding SkillCode}" 
                                               FontFamily="Roboto#300"
                                               FontSize="16" 
                                               FontAttributes="None" 
                                               TextColor="#FF888888"
                                               Margin="10,0,0,0"
                                               AbsoluteLayout.LayoutBounds="0,0.5,-1,-1" 
                                                   AbsoluteLayout.LayoutFlags="PositionProportional" />
                                            <Image x:Name="statusButton"
                                               Margin="0,0,20,0"
                                               Source="{Binding StateIcon}" HeightRequest="7" WidthRequest="13" AbsoluteLayout.LayoutBounds="1,0.5,-1,-1" AbsoluteLayout.LayoutFlags="PositionProportional" />
                                            <Button AbsoluteLayout.LayoutFlags="All" 

                                                AbsoluteLayout.LayoutBounds="0,0,1,1" BackgroundColor="Transparent" Clicked="SkillListHeaderTapped" CommandParameter="{Binding .}" />
                                        </AbsoluteLayout>
                                    </AbsoluteLayout>
                             <Editor Text="{Binding Description}" 
                                               FontFamily="Roboto#300"
                                               FontSize="16" 
                                     IsEnabled="false"
                                      IsVisible="{Binding IsVisible}"
                                                Margin="10,0,0,10"
                                                 BackgroundColor="White"
                                               FontAttributes="None" 
                                    Grid.Row="1"
                                               TextColor="#FF686868"
                                               />

                        </Grid>




                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </localRenderer:NativeListView>

0 个答案:

没有答案