Merge pull request #872 from daserge/wpf-treeview-shift-tab-crash
[WPF] Fixes a crash for ArrowUp into treeview without selected row
This commit is contained in:
Коммит
8edd1a58e4
|
@ -313,6 +313,9 @@ namespace Xwt.WPFBackend
|
|||
|
||||
public void SelectItem(ExTreeViewItem item)
|
||||
{
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
FocusItem(item);
|
||||
if (!CtrlPressed)
|
||||
SelectedItems.Clear();
|
||||
|
@ -450,7 +453,12 @@ namespace Xwt.WPFBackend
|
|||
int indexOfP = items.IndexOf(p);
|
||||
if (indexOfP == 0)
|
||||
return p;
|
||||
else
|
||||
else if (indexOfP == -1) {
|
||||
if (items.Count > 0)
|
||||
return items [items.Count - 1];
|
||||
|
||||
return null;
|
||||
} else
|
||||
return items[indexOfP - 1];
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,9 @@ namespace Xwt.WPFBackend
|
|||
|
||||
protected override void OnExpanded (RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is TreeStoreNode))
|
||||
return;
|
||||
|
||||
var node = (TreeStoreNode)DataContext;
|
||||
view.Backend.Context.InvokeUserCode (delegate {
|
||||
((ITreeViewEventSink)view.Backend.EventSink).OnRowExpanding (node);
|
||||
|
@ -71,10 +74,10 @@ namespace Xwt.WPFBackend
|
|||
|
||||
protected override void OnCollapsed(RoutedEventArgs e)
|
||||
{
|
||||
var node = DataContext as TreeStoreNode;
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
if (!(DataContext is TreeStoreNode))
|
||||
return;
|
||||
|
||||
var node = (TreeStoreNode)DataContext;
|
||||
if (!IsExpanded)
|
||||
UnselectChildren((object o, ExTreeViewItem i) =>
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче