本文整理汇总了C#中Microsoft.Phone.Controls.LongListSelector类的典型用法代码示例。如果您正苦于以下问题:C# LongListSelector类的具体用法?C# LongListSelector怎么用?C# LongListSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongListSelector类属于Microsoft.Phone.Controls命名空间,在下文中一共展示了LongListSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddVisibileContainers
/// <summary>
/// Retrieves the visible containers in a LongListSelector and adds them to <paramref name="items"/>.
/// </summary>
/// <param name="list">LongListSelector that contains the items.</param>
/// <param name="itemsPanel">Direct parent of the items.</param>
/// <param name="items">List to populate with the containers currently in the viewport</param>
/// <param name="selectContent">
/// Specifies whether to return the container or its content.
/// For headers, we can't apply projections on the container directly
/// (or everything will go blank), so we will apply them on the
/// content instead.
/// </param>
private static void AddVisibileContainers(LongListSelector list, Canvas itemsPanel, List<KeyValuePair<double, FrameworkElement>> items, bool selectContent)
{
foreach (DependencyObject obj in itemsPanel.GetVisualChildren())
{
ContentPresenter container = obj as ContentPresenter;
if (container != null &&
(!selectContent ||
(VisualTreeHelper.GetChildrenCount(container) == 1 &&
VisualTreeHelper.GetChild(container, 0) is FrameworkElement)))
{
GeneralTransform itemTransform = null;
try
{
itemTransform = container.TransformToVisual(list);
}
catch (ArgumentException)
{
// Ignore failures when not in the visual tree
break;
}
Rect boundingBox = new Rect(itemTransform.Transform(new Point()), itemTransform.Transform(new Point(container.ActualWidth, container.ActualHeight)));
if (boundingBox.Bottom > 0 && boundingBox.Top < list.ActualHeight)
{
items.Add(
new KeyValuePair<double, FrameworkElement>(
boundingBox.Top,
selectContent
? (FrameworkElement)VisualTreeHelper.GetChild(container, 0)
: container));
}
}
}
}
示例2: LongListSelectorHelper
public LongListSelectorHelper(LongListSelector longListSelector)
{
longListSelector.SelectionChanged += (sender, args) =>
{
var methodName = GetSelectionChangedMethodName(longListSelector);
var dataContext = GetMethodContext(longListSelector);
if (dataContext == null)
{
dataContext = longListSelector.DataContext;
}
var method = dataContext.GetType().GetTypeInfo().GetDeclaredMethod(methodName);
var parms = method.GetParameters();
if (parms != null && parms.Length == 1)
{
method.Invoke(dataContext, new[] { longListSelector.SelectedItem });
}
else
{
method.Invoke(dataContext, null);
}
};
}
示例3: LongListSelectorAnimator
/// <summary>
/// Konstruktor.
/// </summary>
/// <param name="dispatcher">Der Dispatcher der Seite des LongListSelectors.</param>
/// <param name="longListSelector">Der LongListSelector zum animieren.</param>
internal LongListSelectorAnimator(Dispatcher dispatcher, LongListSelector longListSelector)
{
this.dispatcher = dispatcher;
longListSelector.GroupViewOpened += LongListSelector_GroupViewOpened;
longListSelector.GroupViewClosing += LongListSelector_GroupViewClosing;
}
示例4: GetItemsInViewPort
/// <summary>
/// Gets the items that are currently in the viewport
/// of a LongListSelector and adds them
/// into a list of weak references.
/// </summary>
/// <param name="list">
/// The LongListSelector instance to search on.
/// </param>
/// <param name="items">
/// The list of weak references where the items in
/// the viewport will be added.
/// </param>
public static void GetItemsInViewPort(LongListSelector list, IList<WeakReference> items)
{
DependencyObject child = list;
if (VisualTreeHelper.GetChildrenCount(list) == 0)
{
// no child yet
return;
}
list.UpdateLayout();
do
{
child = VisualTreeHelper.GetChild(child, 0);
} while (VisualTreeHelper.GetChildrenCount(child) > 0 && !(child is Canvas));
if (child is Canvas &&
VisualTreeHelper.GetChildrenCount(child) > 0 &&
VisualTreeHelper.GetChild(child, 0) is Canvas)
{
Canvas headersPanel = (Canvas)child;
Canvas itemsPanel = (Canvas)VisualTreeHelper.GetChild(child, 0);
var itemsInList = new List<KeyValuePair<double, FrameworkElement>>();
AddVisibileContainers(list, itemsPanel, itemsInList, /* selectContent = */ false);
AddVisibileContainers(list, headersPanel, itemsInList, /* selectContent = */ true);
foreach (var pair in itemsInList.OrderBy(selector => selector.Key))
{
items.Add(new WeakReference(pair.Value));
}
}
}
示例5: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/PeopleHub;component/MainPage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.peopleLongListSelector = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("peopleLongListSelector")));
}
示例6: BindLLS
private void BindLLS(LongListSelector element)
{
this.lls = element;
this.lls.ManipulationStateChanged += lls_ManipulationStateChanged;
this.lls.MouseLeftButtonDown += lls_MouseLeftButtonDown;
this.lls.MouseMove += lls_MouseMove;
this.lls.ItemRealized += OnViewportChanged;
this.lls.ItemUnrealized += OnViewportChanged;
}
示例7: SetListUnableAndShowMessage
public void SetListUnableAndShowMessage(LongListSelector list, TextBlock messageTextBlock, string message)
{
this.Dispatcher.BeginInvoke(() =>
{
list.Visibility = Visibility.Collapsed;
messageTextBlock.Text = message;
messageTextBlock.Visibility = Visibility.Visible;
});
}
示例8: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/SACIS;component/Pages/Messages/Inbox/Inbox.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.LLsMensagens = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("LLsMensagens")));
}
示例9: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/MetroFanfou;component/UserControls/MessageList.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.DataListBox = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("DataListBox")));
}
示例10: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Inviticus;component/Immunization.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
this.ImmunizationList = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("ImmunizationList")));
}
示例11: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/PsychicTest;component/View/Score.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
this.LstHighScore = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("LstHighScore")));
}
示例12: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Map%20Application%20With%20Google%20API;component/HomePage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
this.longlist = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("longlist")));
}
示例13: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/site2App.WP8;component/SharePage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
this.ListSelector = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("ListSelector")));
}
示例14: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/PocketSphinxWindowsPhoneDemo;component/PlaylistPage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
this.AddrSong1 = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("AddrSong1")));
}
示例15: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/map-routing;component/MainPage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.MyMap = ((Microsoft.Phone.Maps.Controls.Map)(this.FindName("MyMap")));
this.RouteLLS = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("RouteLLS")));
}