<ComboBox Name="ss" Margin="200,200,0,0" Width="200" Height="50">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding Image}" Height="50" Width="50"></Image>
                        <TextBlock Text="{Binding Name}" Height="50" Width="50"></TextBlock>
                    </StackPanel>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GridExp
{
    public class CounteryInfo : INotifyPropertyChanged
    {
        private string _name;

        private void FirePropertyChanged(string propName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
            }
        }

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
                FirePropertyChanged("Name");
            }
        }

        private string img;

        public string Image
        {
            get { return img; }
            set
            {
                img = value;
                FirePropertyChanged("Image");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
   protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                List<CounteryInfo> list = new List<CounteryInfo>();
                list.Add(new CounteryInfo { Name = "321", Image = "ms-appx:///images/w_bizhi.jpg" });
                list.Add(new CounteryInfo { Name = "432", Image = "ms-appx:///images/w_meinv.jpg" });
                ss.ItemsSource = list;
            }

        }

 

posted on 2012-12-03 16:08  振宇爸爸  阅读(257)  评论(0编辑  收藏  举报