本文整理汇总了C#中System.Windows.Controls.ListView.ScrollIntoView方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.ScrollIntoView方法的具体用法?C# ListView.ScrollIntoView怎么用?C# ListView.ScrollIntoView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ListView
的用法示例。
在下文中一共展示了ListView.ScrollIntoView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScrollToLastItem
public void ScrollToLastItem(ListView lv)
{
lv.SelectedItem = lv.Items.GetItemAt(lv.Items.Count - 1);
lv.ScrollIntoView(lv.SelectedItem);
ListViewItem item = lv.ItemContainerGenerator.ContainerFromItem(lv.SelectedItem) as ListViewItem;
if (item != null)
{
item.Focus();
}
}
示例2: ListView_ItemsChanged
private void ListView_ItemsChanged(ListView listView, ItemsChangedEventArgs e)
{
DebugHelper.AssertUIThread();
if ((listView != null) && (e != null))
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
if (MetadataViewContent.lastFocused == this)
{
int newIndex = listView.Items.Count - 1;
listView.SelectedIndex = newIndex;
listView.ScrollIntoView(listView.Items[newIndex]);
this.setNextMetadatFocus = listView;
}
break;
default:
this.setNextMetadatFocus = null;
break;
}
}
}
示例3: List_OnLoaded
void List_OnLoaded(object sender, RoutedEventArgs e)
{
list = (ListView) sender;
list.ScrollIntoView(list.SelectedItem);
}
示例4: OnAutoScrollToCurrentItem
/// <summary>
/// This method will be called when the ListBox should
/// be scrolled to the given index
/// </summary>
/// <param name="listBox">The ListBox which should be scrolled</param>
/// <param name="index">The index of the item to which it should be scrolled</param>
public static void OnAutoScrollToCurrentItem(ListView listBox, int index)
{
if (listBox != null && listBox.Items != null && listBox.Items.Count > index && index >= 0)
listBox.ScrollIntoView(listBox.Items[index]);
}
示例5: ScrollToLastItem
public void ScrollToLastItem(ListView lv)
{
lv.ScrollIntoView(lv.Items.GetItemAt(lv.Items.Count - 1));
}
示例6: AddTasks
private void AddTasks(Type[] taskTypes, ListView listView)
{
if (taskTypes == null)
throw new ArgumentNullException("taskTypes");
if (listView == null)
throw new ArgumentNullException("listView");
//if (Tasks.Any(t => t.GetType() == task.GetType()))
//{
// var msg = "Multi".ValidateLicense();
// if (msg != null)
// {
// _logManager.Application.AddErrorLog(msg);
// new MessageBoxBuilder()
// .Text(LocalizedStrings.Str2903Params.Put(task.GetDisplayName()))
// .Warning()
// .Owner(this)
// .Show();
// return;
// }
//}
BusyIndicator.IsBusy = true;
BusyIndicator.BusyContent = LocalizedStrings.Str2904Params.Put(taskTypes.First().GetDisplayName());
var tasks = new List<IHydraTask>();
Task.Factory
.StartNew(() =>
{
foreach (var type in taskTypes)
{
this.GuiSync(() =>
{
BusyIndicator.BusyContent = LocalizedStrings.Str2904Params.Put(type.GetDisplayName());
});
var task = type.CreateInstance<IHydraTask>();
var settings = new HydraTaskSettings
{
Id = Guid.NewGuid(),
WorkingFrom = TimeSpan.Zero,
WorkingTo = TimeHelper.LessOneDay,
IsDefault = true,
TaskType = type.GetTypeName(false),
};
_entityRegistry.TasksSettings.Add(settings);
_entityRegistry.TasksSettings.DelayAction.WaitFlush();
InitTask(task, settings);
var allSec = _entityRegistry.Securities.ReadById(Core.Extensions.AllSecurityId);
task.Settings.Securities.Add(task.ToTaskSecurity(allSec));
task.Settings.Securities.DelayAction.WaitFlush();
tasks.Add(task);
}
})
.ContinueWithExceptionHandling(this, res =>
{
BusyIndicator.IsBusy = false;
if (!res)
return;
Tasks.AddRange(tasks);
var last = tasks.LastOrDefault();
if (last != null)
{
NavigationBar.SelectedIndex = last.IsCategoryOf(TaskCategories.Tool) ? 1 : 0;
listView.SelectedItem = last;
listView.ScrollIntoView(last);
foreach (var task in tasks)
{
var pane = EnsureTaskPane(task);
if (pane != null)
ShowPane(pane);
//EditTask(newTask);
}
}
});
}
示例7: OnAutoScrollToCurrentItem
/// <summary>
/// This method will be called when the ListBox should
/// be scrolled to the given index
/// </summary>
/// <param name="listView">The ListBox which should be scrolled</param>
/// <param name="index">The index of the item to which it should be scrolled</param>
public static void OnAutoScrollToCurrentItem(ListView listView)
{
listView.ScrollIntoView(listView.Items.CurrentItem);
}
示例8: ShowLrc
/// <summary>
/// 显示歌词
/// </summary>
public void ShowLrc(int min, int sec,TextBox txtb1,ListView lrc1)
{
if (count >= maxCount || maxCount <= 0) return;
int time = min * 60 + sec;
string show;
if (time < lrcTime[0])
{
show = "歌名:" + ti + "演唱:" + ar + "专辑:" + al + "制作:" + by;
txtb1.Text = show;
}
if (time == lrcTime[count])
{
show = lrcText[lrcIndex[count++]];
lrc1.SelectedItem = show;
lrc1.ScrollIntoView(lrc1.SelectedItem);
txtb1.Text = show;
}
else if (time > lrcTime[count])
{
int i2 = lrcTime.Count();
for (int i = count; i < i2 - 1; i++)
{
if (time <= lrcTime[i])
{
count = i;
break;
}
}
}
else if (count > 0 && time < lrcTime[count - 1])
{
for (int i = 0; i < count - 1; i++)
{
if (time >= lrcTime[i])
{
count = i;
break;
}
}
}
}