本文整理汇总了C#中System.Windows.Controls.ListBox.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.GetValue方法的具体用法?C# ListBox.GetValue怎么用?C# ListBox.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ListBox
的用法示例。
在下文中一共展示了ListBox.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetHasBindableSelectedItems
public static void SetHasBindableSelectedItems(ListBox source, bool value)
{
SelectionChangedHandler Handler = (SelectionChangedHandler)source.GetValue(SelectionChangedHandlerProperty);
if (value && Handler == null)
{
Handler = new SelectionChangedHandler(source);
source.SetValue(SelectionChangedHandlerProperty, Handler);
}
else if (!value && Handler != null)
{ source.ClearValue(SelectionChangedHandlerProperty); }
}
示例2: GetOrCreateBehavior
private static SelectedItemsBehavior GetOrCreateBehavior(ListBox target, IList list)
{
var behavior = target.GetValue(SelectedItemsBehaviorProperty) as SelectedItemsBehavior;
if (behavior == null)
{
behavior = new SelectedItemsBehavior(target, list);
target.SetValue(SelectedItemsBehaviorProperty, behavior);
}
return behavior;
}
示例3: GetOrCreateBehavior
private static ListSelectCommandBehavior GetOrCreateBehavior(ListBox selector)
{
var behavior = selector.GetValue(SelectCommandBehaviorProperty) as ListSelectCommandBehavior;
if (behavior == null)
{
behavior = new ListSelectCommandBehavior(selector);
selector.SetValue(SelectCommandBehaviorProperty, behavior);
}
return behavior;
}
示例4: SetAutoScroll
public static void SetAutoScroll(ListBox instance, bool value)
{
var oldHandler = (AutoScrollHandler)instance.GetValue(AutoScrollHandlerProperty);
if (oldHandler != null)
{
oldHandler.Dispose();
instance.SetValue(AutoScrollHandlerProperty, null);
}
instance.SetValue(AutoScrollProperty, value);
if (value)
instance.SetValue(AutoScrollHandlerProperty, new AutoScrollHandler(instance));
}
示例5: GetOrCreateBehavior
private static ListBoxSelectionChangedCommandBehavior GetOrCreateBehavior(ListBox ListBox)
{
ListBoxSelectionChangedCommandBehavior behavior =
ListBox.GetValue(SelectCommandBehaviorProperty) as ListBoxSelectionChangedCommandBehavior;
if (behavior == null)
{
behavior = new ListBoxSelectionChangedCommandBehavior(ListBox);
ListBox.SetValue(SelectCommandBehaviorProperty, behavior);
}
return behavior;
}
示例6: GetChangedHandler
private static ListChangedHandler GetChangedHandler(ListBox obj)
{
return (ListChangedHandler)obj.GetValue(ChangedHandlerProperty);
}
示例7: GetIsActivatable
public static bool GetIsActivatable(ListBox obj)
{
return (bool)obj.GetValue(IsActivatableProperty);
}
示例8: GetItems
public static IList GetItems(ListBox listBox)
{
return listBox.GetValue(ItemsProperty) as IList;
}
示例9: GetIsListboxItemBringIntoView
public static bool GetIsListboxItemBringIntoView(ListBox listBox)
{
return (bool)listBox.GetValue(IsListboxItemBringIntoViewProperty);
}
示例10: GetIsSelectedItemScrolledIntoView
public static bool GetIsSelectedItemScrolledIntoView(ListBox listBox)
{
return (bool)listBox.GetValue(IsSelectedItemScrolledIntoViewProperty);
}
示例11: DragStarted
private void DragStarted(ListBox listbox)
{
listbox.ClearValue(IsDownProperty); // SetValue to false would also work.
// Add the bound item, available as DraggingElement, to a DataObject, however we see fit.
Artist draggingElement = (Artist)listbox.GetValue(DraggingElementProperty);
DataObject d = new DataObject(DataFormats.Dif, draggingElement);
DragDropEffects effects = DragDrop.DoDragDrop(listbox, d, DragDropEffects.Copy);
if ((effects & DragDropEffects.Move) != 0)
{
// Move rather than copy, so we should remove from bound list.
DataList<Artist> collection = (DataList<Artist>)listbox.ItemsSource;
collection.Remove(draggingElement);
}
}
示例12: GetCenterSelectedItemOnLoad
public static bool GetCenterSelectedItemOnLoad(ListBox ListBox)
{
return (bool)ListBox.GetValue(CenterSelectedItemOnLoadProperty);
}
示例13: GetAutoScroll
public static bool GetAutoScroll(ListBox instance)
{
return (bool)instance.GetValue(AutoScrollProperty);
}
示例14: GetIsAutoCenterItem
public static bool GetIsAutoCenterItem(ListBox element)
{
return (bool)element.GetValue(IsAutoCenterItemProperty);
}
示例15: GetCommand
/// <summary>
/// Retrieves the <see cref="ICommand"/> attached to the <see cref="TextBox"/>.
/// </summary>
/// <param name="selector">TextBox containing the Command dependency property</param>
/// <returns>The value of the command attached</returns>
public static ICommand GetCommand(ListBox selector)
{
return selector.GetValue(CommandProperty) as ICommand;
}