how to make a windows phone app LongListSelecter with Image and strings

前端 未结 2 1524
时光说笑
时光说笑 2021-01-27 05:48

i made a simple long list selector app without jump header or header template. i made it after a long journey in to the google and stack overflow. i was satisfied with it. the

2条回答
  •  死守一世寂寞
    2021-01-27 06:37

    I found a better way to do that.

    Project needs 3 components mainly.

    1. xml file
    2. xml.cs file
    3. class file

    Implications are mainly made in these file.

    In XML file arrange all control drag and drop longlistselector control

    
        
            
                
                    
                    
                
            
        
    
    

    xml.cs

    public partial class MainPage : PhoneApplicationPage
    {
        ObservableCollection speedDialList = new ObservableCollection();
    
        // Constructor
        public MainPage()
        {
    
            InitializeComponent();
            speedDialList = new ObservableCollection ();
            speedDialList.Add(new SpeedDial() { Names = "deepu", Photo =  new Uri("Image/2.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "jilu", Photo =  new Uri("Image/3.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "tinu", Photo =  new Uri("Image/4.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "jhd", Photo = new Uri("Image/7.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "jose", Photo = new Uri("image/1.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "hgscf", Photo =  new Uri("image/2.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "hjsg", Photo =  new Uri("Image/5.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "jhvdj", Photo =  new Uri("Image/6.jpg" ,UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "jhd", Photo =  new Uri("Image/7.jpg",UriKind.Relative) }); 
            speedDialList.Add(new SpeedDial() { Names = "jkgh", Photo =  new Uri("Image/4.jpg",UriKind.Relative) });
            speedDialList.Add(new SpeedDial() { Names = "kigh", Photo =  new Uri("Image/3.jpg",UriKind.Relative) });
            LLs.ItemsSource = speedDialList;
        }
    }
    }}
    

    class file

    namespace yourprojuctname
    {
    class SpeedDial
        {
           public string name;
            public string Names
            {
                get { return name; }
                set { name = value; }
            }
            private Uri photo;
            public Uri Icon
            {
                get { return photo; }
                set { photo = value; }
            }
        }
    }
    

提交回复
热议问题