Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

ListView Alternative or Solution Suggestion?

$
0
0

I'm going to attempt to keep this short.

I'm Busy working on a Mobile Application With Xamarin as the Front end and Woo-commerce as the Back End, Using the Woocommerce.net Wrapper(Can be found on Github at XiaoFaye) To connect with the Api and Pull products/Suppliers ect.

Now the issue's Ive Faced is that, When Creating the list of products with a ListView, I can set everything threw a Products Collection easily except for the Image's and Attributes(It's pretty much the same problem) The images are part of a Nested Class inside of "Products" Called "Images" I need the Source from that Nested Class to set my Listviews(Image) Source, Now I have trouble accessing that nested class(This is a lack of Knowledge on my side for sure), Even if I did it's returned as a list and i'm not sure if you can even bind to a List or a Item in a List (Not setting the Overall Source but just 1 Listview Item's Source). I'll be honest I dont have nearly the experience to be making something like this. So I'm Wondering if Someone has a Suggestion for things I can lookup to maybe resolve this issue, I'd love to solve this just a little out of idea's.

public class ProductBatch : BatchObject { }

[DataContract]
public class Product : JsonObject
{
    public static string Endpoint { get { return "products"; } }

    /// <summary>
    /// Unique identifier for the resource. 
    /// read-only
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public int? id { get; set; }

    /// <summary>
    /// Product name.
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public string name { get; set; }

[DataMember(EmitDefaultValue = false)]
    public List<ProductImage> images { get; set; }

public class ProductImage //Nested Classs
{
///


/// Image ID.
///

[DataMember(EmitDefaultValue = false)]
public long? id { get; set; }

    /// <summary>
    /// The date the image was created, in the site’s timezone. 
    /// read-only
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public DateTime? date_created { get; set; }

    /// <summary>
    /// The date the image was created, as GMT. 
    /// read-only
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public DateTime? date_created_gmt { get; set; }

    /// <summary>
    /// The date the image was last modified, in the site’s timezone. 
    /// read-only
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public DateTime? date_modified { get; set; }

    /// <summary>
    /// The date the image was last modified, as GMT. 
    /// read-only
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public DateTime? date_modified_gmt { get; set; }

    /// <summary>
    /// Image URL.
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public string src { get; set; }

    /// <summary>
    /// Image name.
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public string name { get; set; }

    /// <summary>
    /// Image alternative text.
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public string alt { get; set; }

    /// <summary>
    /// Image position. 0 means that the image is featured.
    /// </summary>
    [DataMember(EmitDefaultValue = false)]
    public int? position { get; set; }
}

Just a little example of the Class Structure.


<ListView.ItemTemplate>


<ViewCell.View>

                                    <Image Source="{Binding  ??? }"/>
                                    <Label Text="{Binding date_created, StringFormat='{0:dd/MM/yyyy}'}" FontSize="Small" FontAttributes="Italic"/>
                                    <Label Text="{Binding price }"/>
                                    <Label Text="{x:Binding enable_html_description  }" FontSize="Medium"/>
                                    <Label Text="{x:Binding sku}" FontSize="Medium"/>
                                    <Button BindingContext="{Binding id}" Clicked="ProductClicked"></Button>
                                </StackLayout>
                            </Frame>

                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>