Code: Select all
<Page
x:Class="Application1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Application1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<TabControl>
<TabItem Header="1 page">
<ComboBox x:Name="Combobox1" Height="100" />
</TabItem>
<TabItem Header="2 page"/>
</TabControl>
</Page>
Code: Select all
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Application1
{
public partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
// Enter construction logic here...
var c = new ObservableCollection<X>();
c.Add(new X() { id = "1", name = "11" });
c.Add(new X() { id = "2", name = "22" });
Combobox1.ItemsSource = c;
}
}
public class X
{
public String id { get; set; }
public String name { get; set; }
}
}