All the fields show ok, only Specilities string[] shows me an error... remember there are two different fids on json response we have Speciality that is OK and show OK... and we have Specilities string[] where is the problem.... check the json response
this is json response
{"_id":"5aab4c02f08d9324fc1283ec","firstName":"Carlos Alberto","lastName":"Cabezas Delgado","password":"$2a$10$BuYWhiMn.9RsBKJN7bWuguKaPAHQocd2eVQCqRaaAdmzrlPkuWYJS","identificationNumber":"0914891684","email":"[email protected]","phone":"0969922421","discount":0.5,"band":3,"city":"59cda262fe728437ce90ff81","role":"59cd270f07308946e6a494f7","__v":6,
"speciality":{"_id":"5a0a6176257e970afc9a9e7f","name":"Propiedad Intelectual","tag":"propiedad-intelectual","__v":0,"icon":"speciality_icon_jg4zpoeqoiwtuuy8jya.png","description":"Derechos de propiedad industrial, derechos de autor, patentes, modelos de utilidad, diseños industriales, marcas, indicaciones geográficas, información comercial confidencial, derecho de obtentor.","id":"5a0a6176257e970afc9a9e7f"},
"profile":"5aac7b42c02ece25becefd47","telephone":"593969922421","createdAt":"2018-08-20T03:07:03.838Z","searchTag":"CARLOSALBERTOCABEZASDELGADO","updatedAt":"2020-06-22T00:17:30.971Z","label":"CARLOS ALBERTO CABEZAS DELGADO","firstNameLabel":"Carlos Alberto","lastNameLabel":"Cabezas Delgado","plan":"5d75e792184bab2c72b3d3ab","seller":"5ad72ce8fd69e7aba867c118","telephone2":"","fax":"593969922421","isPublic":true,"isDelete":false,
"invoices":[],
"specialities":["5990d7273da48f4bd98c6918","5990d73f3da48f4bd98c691a","5a0a6055257e970afc9a9e70","5a0a6087257e970afc9a9e73","5a0a6120257e970afc9a9e7a","5a0a6166257e970afc9a9e7e","5a0a6176257e970afc9a9e7f"],
"location":{"address":"Urbanización Puerto Azul, Guayaquil, Ecuador","reference":"Puerto Azul, Vía la Costa (Edificio Torres del Edén)","latitude":-2.1902934315119,"longitude":-79.9647494058045},"status":2,"id":"5aab4c02f08d9324fc1283ec","search":"CARLOS ALBERTO CABEZAS DELGADO"
MODEL DATA
namespace App1
{
public class AbogadosMongoApi
{
[JsonProperty("_id")]
public string Idab { get; set; }
[JsonProperty("label")]
public string FirtsName { get; set; }
[JsonProperty("email")]
public string Correo { get; set; }
[JsonProperty("phone")]
public string Celular { get; set; }
[JsonProperty("password")]
public string Contrasena { get; set; }
[JsonProperty("isPublic")]
public bool Public { get; set; }
[JsonProperty("band")]
public int Band { get; set; }
[JsonProperty("plan")]
public string Plan { get; set; }
[JsonProperty("city")]
public string Ciudadperfil { get; set; }
[JsonProperty("location")]
public Location location { get; set; }
[JsonProperty("speciality")]
public Speciality speciality { get; set; }
[JsonProperty("specialities")]
public string[] Specialities { get; set; }
}
public class Speciality
{
[JsonProperty("_id")]
public string Idespecialidad { get; set; }
[JsonProperty("name")]
public string Nombrespecialidad { get; set; }
[JsonProperty("icon")]
public string Iconespecialidad { get; set; }
[JsonProperty("description")]
public string Descespecialidad { get; set; }
}
public class Location
{
[JsonProperty("address")]
public string Direccion { get; set; }
[JsonProperty("reference")]
public string Referencia { get; set; }
[JsonProperty("latitude")]
public string Latitud { get; set; }
[JsonProperty("longitude")]
public string Longitud { get; set; }
}
}
XAML
<CollectionView x:Name="abogadosrec"
BackgroundColor="#eee"
SelectionMode="Single"
SelectionChanged="CallBtnClicked"
VerticalOptions="StartAndExpand"
HorizontalOptions="CenterAndExpand">
<CollectionView.ItemTemplate>
<DataTemplate>
<SwipeView>
<SwipeView.LeftItems>
<SwipeItems>
</SwipeItems>
</SwipeView.LeftItems>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Crear Cita"
BackgroundColor="#00a783" />
</SwipeItems>
</SwipeView.RightItems>
<Grid Style="{StaticResource IndicatorLabelStyle}"
Padding="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Frame CornerRadius="100"
HeightRequest="75"
WidthRequest="75"
BorderColor="#cca876"
HorizontalOptions="Center"
Padding="0"
IsClippedToBounds="True">
<Image xct:TouchEffect.PressedScale="1.4"
Grid.RowSpan="2"
Source="{Binding Idab, StringFormat='https://abogadosecuador.com.ec/profile/picture/{0:N}'}"
Aspect="AspectFill"
HeightRequest="75"
WidthRequest="75" />
</Frame>
<Label Grid.Column="1"
Text="{Binding FirtsName}"
VerticalOptions="CenterAndExpand"
HorizontalOptions="StartAndExpand"
FontSize="Micro"
FontAttributes="Bold" />
<ListView ItemsSource="{Binding .}"
HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label FontSize="3" Text="{Binding Specialities}"></Label>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Grid.Column="1"
x:Name="txtNumero" IsVisible="false"
Text="{Binding Celular, Mode=TwoWay}"
FontAttributes="Italic"
VerticalOptions="CenterAndExpand"
HorizontalOptions="StartAndExpand" />
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
<CollectionView.Header>
<StackLayout BackgroundColor="LightGray">
<Label Margin="10,0,0,0"
Padding="10"
Text="Abogados Registrados"
FontSize="Small" />
</StackLayout>
</CollectionView.Header>
</CollectionView>
CodePudding user response:
this
<ListView ItemsSource="{Binding .}"
should be
<ListView ItemsSource="{Binding Specialities}"
and this
<Label FontSize="3" Text="{Binding Specialities}" />
should be
<Label FontSize="3" Text="{Binding .}" />