Size: a a a

Xamarin Developers (MAUI)

2021 April 28

VK

Vlad Khasenevich in Xamarin Developers (MAUI)
+
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
А
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Ну ок, зря быканул
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Но все равно, с нуля по тому гайду пробуйте
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Где-то может resource какой-то не создали
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Или забыли ViewCell
источник

S

Slav0n in Xamarin Developers (MAUI)
Прошелся по гайду снова.
вот такой получился xaml:

   <ContentPage.Content>
       <ScrollView>
           <StackLayout VerticalOptions="FillAndExpand">
               <ListView x:Name="ListViewDevices" SelectionMode="None" HasUnevenRows="True" SeparatorVisibility="None" ItemTemplate="{StaticResource selector}"/>
           </StackLayout>
       </ScrollView>
   </ContentPage.Content>
   <ContentPage.Resources>
       <ResourceDictionary>
           <DataTemplate x:Key="device">
               <cell:CellDevice/>
           </DataTemplate>
           <DataTemplate x:Key="phone">
               <cell:CellPhone/>
           </DataTemplate>
           <DataTemplate x:Key="pc">
               <cell:CellPC/>
           </DataTemplate>
           <local:DevicesTemplateSelector x:Key="selector" DevicesTemplate="{StaticResource device}" PhoneTemplate="{StaticResource phone}" PCTemplate="{StaticResource pc}"/>
       </ResourceDictionary>
   </ContentPage.Resources>

В DevicesTemplateSelector выпилил инициализатор, остальное все так же. Ошибка осталась та же.
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
А покажите-ка  CellDevice
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
И попробуйте resources перед content вставить
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
И listview желательно не вставлять в scrollview
источник

S

Slav0n in Xamarin Developers (MAUI)
Это осталось от костылей, забыл убрать)
источник

S

Slav0n in Xamarin Developers (MAUI)
<ViewCell.View>
       <StackLayout Orientation="Vertical">
           <StackLayout Orientation="Vertical" Margin="10">
               <StackLayout Orientation="Vertical">
                   <StackLayout Orientation="Horizontal">
                       <Label Text="{Binding TitleType}" TextColor="Black" FontSize="Large" HorizontalOptions="StartAndExpand" VerticalOptions="Center"/>
                       <Button Text="Больше" TextColor="Blue" TextTransform="Uppercase" BackgroundColor="Transparent" VerticalOptions="Center" x:Name="FullInfoButton" Clicked="ExpandFullData"/>
                   </StackLayout>
                   <Label Text="{Binding FullName}"/>
                   <StackLayout Orientation="Vertical" IsVisible="False" x:Name="FullInfo">
                       <StackLayout Orientation="Horizontal">
                           <Label Text="Производитель" HorizontalOptions="Start"/>
                           <BoxView VerticalOptions="End" HorizontalOptions="FillAndExpand" HeightRequest="0.1" Color="LightGray" Margin="-5, 0, -4, 4"/>
                           <Label Text="{Binding Developer}" TextColor="Black" FontAttributes="Bold"/>
                       </StackLayout>
                       <StackLayout Orientation="Horizontal">
                           <Label Text="Модель" HorizontalOptions="Start"/>
                           <BoxView VerticalOptions="End" HorizontalOptions="FillAndExpand" HeightRequest="0.1" Color="LightGray" Margin="-5, 0, -4, 4"/>
                           <Label Text="{Binding Model}" TextColor="Black" FontAttributes="Bold"/>
                       </StackLayout>
                       <StackLayout Orientation="Horizontal">
                           <Label Text="Серийный номер" HorizontalOptions="Start"/>
                           <BoxView VerticalOptions="End" HorizontalOptions="FillAndExpand" HeightRequest="0.1" Color="LightGray" Margin="-5, 0, -4, 4"/>
                           <Label Text="{Binding Serial}" TextColor="Black" FontAttributes="Bold"/>
                       </StackLayout>
                       <StackLayout Orientation="Horizontal">
                           <Label Text="Дата установки" HorizontalOptions="Start"/>
                           <BoxView VerticalOptions="End" HorizontalOptions="FillAndExpand" HeightRequest="0.1" Color="LightGray" Margin="-5, 0, -4, 4"/>
                           <Label Text="{Binding InstallDate}" TextColor="Black" FontAttributes="Bold"/>
                       </StackLayout>
                       <StackLayout Orientation="Horizontal">
                           <Label Text="Дата обслуживания" HorizontalOptions="Start"/>
                           <BoxView VerticalOptions="End" HorizontalOptions="FillAndExpand" HeightRequest="0.1" Color="LightGray" Margin="-5, 0, -4, 4"/>
                           <Label Text="{Binding MaintDate}" TextColor="Black" FontAttributes="Bold"/>
                       </StackLayout>
                   </StackLayout>
               </StackLayout>
           </StackLayout>
           <BoxView HeightRequest="10" Color="WhiteSmoke" Margin="0"/>
       </StackLayout>
   </ViewCell.View>
источник

S

Slav0n in Xamarin Developers (MAUI)
С одним только DataTemplate все работает и отображается как надо
источник

S

Slav0n in Xamarin Developers (MAUI)
А вот с DataTemplateSelector уже вот это
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Тут вроде норм
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Это сделали?
источник

S

Slav0n in Xamarin Developers (MAUI)
Бесполезно
источник

MO

Mr. Onion in Xamarin Developers (MAUI)
Ок, сдаюсь
источник

S

Slav0n in Xamarin Developers (MAUI)
да
источник

СУ

Сраний Умний... in Xamarin Developers (MAUI)
а с двумя? удалите максимум UI с темплейтов, оставьте только минимально, чтоби могли розличить что где. Может в самих селах проблема есть
источник