Browse Source

Make DropDown mouse selection work.

pull/72/merge
Steven Kirk 11 years ago
parent
commit
c301f8d922
  1. 9
      Perspex.Controls/DropDown.cs
  2. 10
      Perspex.Controls/Primitives/Popup.cs

9
Perspex.Controls/DropDown.cs

@ -7,11 +7,13 @@
namespace Perspex.Controls
{
using System;
using System.Linq;
using Generators;
using Perspex.Controls.Primitives;
using Perspex.Controls.Templates;
using Perspex.Input;
using Perspex.Layout;
using VisualTree;
public class DropDown : SelectingItemsControl, IContentControl
{
@ -93,8 +95,13 @@ namespace Perspex.Controls
{
if (!this.IsDropDownOpen)
{
this.IsDropDownOpen = true;
if (((IVisual)e.Source).GetVisualAncestors().Last().GetType() != typeof(PopupRoot))
{
this.IsDropDownOpen = true;
}
}
base.OnPointerPressed(e);
}
protected override void OnTemplateApplied()

10
Perspex.Controls/Primitives/Popup.cs

@ -139,7 +139,8 @@ namespace Perspex.Controls.Primitives
}
/// <summary>
/// Gets or sets a value indicating whether the popup should stay open when the popup loses focus.
/// Gets or sets a value indicating whether the popup should stay open when the popup is
/// pressed or loses focus.
/// </summary>
public bool StaysOpen
{
@ -316,13 +317,6 @@ namespace Perspex.Controls.Primitives
{
if (!this.StaysOpen)
{
var routed = e as RoutedEventArgs;
if (routed != null)
{
routed.Handled = true;
}
this.Close();
}
}

Loading…
Cancel
Save