WinrtXamlToolkitのTreeViewを使用しています。このコントロールのデフォルトの動作は、ヘッダーのダブルクリックでネストされた項目を展開することです。これを担当するコードは(TreeViewItem.cs line 1205)です。WinrtXamlToolkit TreeViewダブルクリックではなくシングルで展開する
private void OnHeaderMouseLeftButtonDown(object sender, PointerRoutedEventArgs e)
{
if (Interaction.AllowMouseLeftButtonDown(e))
{
// If the event hasn't already been handled and this item is
// focusable, then focus (and possibly expand if it was double
// clicked)
if (!e.Handled && IsEnabled)
{
if (Focus(FocusState.Programmatic))
{
e.Handled = true;
}
// Expand the item when double clicked
if (Interaction.ClickCount % 2 == 0)
{
bool opened = !IsExpanded;
UserInitiatedExpansion |= opened;
IsExpanded = opened;
e.Handled = true;
}
}
Interaction.OnMouseLeftButtonDownBase();
OnPointerPressed(e);
}
}
実際にコントロールをコピーすることなく、シングルクリックまたはタップ上の項目を拡大するには、この動作を変更する方法はありますし、すべてのそれは私のプロジェクトにクラスを関連するのですか?
数行のコードを変更するには、これを行うのが面倒なようです。
これはきちんとした考えです。やってみます。 – Corcus