本文整理汇总了C#中System.Windows.Controls.ListBox.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.Equals方法的具体用法?C# ListBox.Equals怎么用?C# ListBox.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ListBox
的用法示例。
在下文中一共展示了ListBox.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDataFromListBox
/// <summary>The get data from list box.</summary>
/// <param name="source">The source.</param>
/// <param name="point">The point.</param>
/// <returns>The <see cref="object"/>.</returns>
private static object GetDataFromListBox(ListBox source, Point point)
{
var element = source.InputHitTest(point) as UIElement;
if (element == null)
{
return null;
}
var data = DependencyProperty.UnsetValue;
while (data == DependencyProperty.UnsetValue)
{
if (element == null)
{
continue;
}
data = source.ItemContainerGenerator.ItemFromContainer(element);
if (data == DependencyProperty.UnsetValue)
{
element = VisualTreeHelper.GetParent(element) as UIElement;
}
if (source.Equals(element))
{
return null;
}
}
return data != DependencyProperty.UnsetValue ? data : null;
}
示例2: InitElement
void InitElement(ListBox listBox, List<TagInfo> tagInfos)
{
//!!!貌似不起作用
LogManager.Ins.Log("开始加载数据Tag到UI");
Thread thread = new Thread(new ThreadStart(() =>
{
Dispatcher.BeginInvoke(() =>
{
listBox.Items.Clear();
foreach (TagInfo item in tagInfos)
{
Button button = new Button();
button.Style = Application.Current.Resources["TagsButtonStyle"] as Style;
button.Foreground = new SolidColorBrush(Colors.White);
button.Background = new SolidColorBrush(Colors.White);
button.Height = 35;
button.Margin = new Thickness(0, 20, 0, 0);
button.Content = item.TagName;
button.Tag = item;
button.Tap += new EventHandler<GestureEventArgs>(button_Tap);
if (button.Content.ToString() == "全部")
button.Background = new SolidColorBrush(Utils.Utils.GetColor("#FF00AEFF"));
listBox.Items.Add(button);
}
if (listBox.Equals(xCatalogListBox))
{
xCatalogProgressBar.Visibility = Visibility.Collapsed;
}
else if (listBox.Equals(xAreaListBox))
{
xAreaProgressBar.Visibility = Visibility.Collapsed;
}
else if (listBox.Equals(xYearListBox))
{
xYearProgressBar.Visibility = Visibility.Collapsed;
}
}
);
}));
thread.IsBackground = true;
thread.Start();
LogManager.Ins.Log("加载完数据Tag到UI");
}
示例3: GetListItemByIndex
private ListBoxItem GetListItemByIndex(ListBox parent, int index)
{
if (parent.Equals(null)) return null;
var generator = parent.ItemContainerGenerator;
if ((index >= 0) && (index < parent.Items.Count))
return generator.ContainerFromIndex(index) as ListBoxItem;
return null;
}