本文整理汇总了C#中System.Windows.Controls.ListBox.Dispatch方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.Dispatch方法的具体用法?C# ListBox.Dispatch怎么用?C# ListBox.Dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ListBox
的用法示例。
在下文中一共展示了ListBox.Dispatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListFollowings
public void ListFollowings()
{
this.Dispatch(() =>
{
TabItem ti = new TabItem();
StackPanel h = new StackPanel();
h.Orientation = Orientation.Horizontal;
TextBlock tx = new TextBlock { Text = String.Format(MessageHeaderUserFollowingFormat, ViewingUser.ScreenName) };
Button cl = new Button();
cl.Margin = new Thickness(2);
cl.Content = new TextBlock { FontFamily = new FontFamily("Marlett"), FontSize = 7, Text = "r" };
cl.Tag = ti;
cl.Click += cl_Click;
cl.Template = GetTemplate("FlatButton");
cl.Background = Brushes.LightGray;
h.Children.Add(tx);
h.Children.Add(cl);
ti.Header = h;
ListBox lb = new ListBox();
lb.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
lb.HorizontalContentAlignment = HorizontalAlignment.Stretch;
lb.SetValue(ScrollViewer.CanContentScrollProperty, false);
ti.Content = lb;
MainTab.Items.Add(ti);
MainTab.SelectedItem = ti;
Service.ListFriends(new ListFriendsOptions { UserId = ViewingUser.Id, Count = (byte)ListFollowingCount }, (tl, res) =>
{
lb.Dispatch(() =>
{
//TwitterState.Dispatch(() => TwitterState.Content = res.ToString());
if (tl == null) return;
foreach (var u in tl)
{
lb.Items.Add(CreateUserPanel(u));
}
if (tl.NextCursor == 0) return;
Button morefw = new Button();
morefw.Content = "さらに表示";
morefw.Click += morefr_Click;
morefw.Tag = new FFInfo { Cursor = tl.NextCursor, User = ViewingUser, TargetListBox = lb };
lb.Items.Add(morefw);
});
});
});
}