1.引用:
2.xaml:
FontFamily="{StaticResource PhoneFontFamilySemiBold}"
FontSize="48"
Margin="8,0,0,0"
Foreground="White"
VerticalAlignment="Bottom"/>
Padding="8,0,0,0" Width="62" Height="62"
HorizontalAlignment="Left">
Foreground="#FFFFFF"
FontSize="48"
FontFamily="{StaticResource PhoneFontFamilySemiLight}"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"/>
3.后台cs代码
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
Loaded += new RoutedEventHandler(MainPage_Loaded);
LongList.SelectionChanged += new SelectionChangedEventHandler(LongList_SelectionChanged);
}
void LongList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (LongList.SelectedItem != null)
{
var d = LongList.SelectedItem as mydata;
if (d != null)
{
}
}
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
List> dt = new List>();
for (int i = 0; i < 10; i++)
{
dt.Add(new Group(i.ToString(), getContent(i)));
}
LongList.ItemsSource = dt;
}
IEnumerable getContent(int k)
{
List dt = new List();
for (int i = 0; i < 10; i++)
{
dt.Add(new mydata() { Name = i.ToString() + "key", Content = i.ToString() + "val" });
}
return dt;
}
}
public class Group : IEnumerable
{
public Group(S groupItem, IEnumerable items)
{
this.GroupItem = groupItem;
this.Items = new List(items);
}
public override bool Equals(object obj)
{
Group other = obj as Group;
return (other != null) && (GroupItem.Equals(other.GroupItem));
}
public override int GetHashCode()
{
return GroupItem.GetHashCode();
}
public S GroupItem { get; set; }
public IList Items { get; set; }
public IEnumerator GetEnumerator()
{
return Items.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return Items.GetEnumerator();
}
}
public class mydata
{
public string Name { get; set; }
public string Content { get; set; }
}
WP7之LongListSelector控件
精选 转载文章标签 LongListSelector 文章分类 后端开发
下一篇:一个简单的打地鼠游戏
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
2024beginctfpwn题解wp
新年快乐CTFer!!
2024beginctf pwn 题解wp -
WP7开发学习:第一个WP7程序—Hello WP7
WP7开发学习:第一个WP7程序—Hello WP7
职场 程序 学习 休闲 WP7