Browse Source

Make items show in dropdown.

pull/39/head
Steven Kirk 11 years ago
parent
commit
e70f4363ac
  1. 5
      Perspex.Themes.Default/DropDownStyle.cs
  2. 25
      TestApplication/Program.cs
  3. 8
      Windows/Perspex.Win32/PopupImpl.cs
  4. 4
      Windows/Perspex.Win32/WindowImpl.cs

5
Perspex.Themes.Default/DropDownStyle.cs

@ -81,7 +81,10 @@ namespace Perspex.Themes.Default
},
new Popup
{
Child = new TextBlock { Text = "Hello World" },
Child = new ItemsControl
{
[~ListBox.ItemsProperty] = control[~DropDown.ItemsProperty],
},
PlacementTarget = control,
[~Popup.IsOpenProperty] = control[~DropDown.IsDropDownOpenProperty],
}

25
TestApplication/Program.cs

@ -333,6 +333,18 @@ namespace TestApplication
Header = "Lists",
Content = new StackPanel
{
DataTemplates = new DataTemplates
{
new DataTemplate<Item>(x =>
new StackPanel
{
Children = new Controls
{
new TextBlock { Text = x.Name, FontSize = 24 },
new TextBlock { Text = x.Value },
}
})
},
Orientation = Orientation.Horizontal,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
@ -346,23 +358,12 @@ namespace TestApplication
},
new ListBox
{
DataTemplates = new DataTemplates
{
new DataTemplate<Item>(x =>
new StackPanel
{
Children = new Controls
{
new TextBlock { Text = x.Name, FontSize = 24 },
new TextBlock { Text = x.Value },
}
})
},
Items = listBoxData,
},
new DropDown
{
Content = "Dropdown",
Items = listBoxData,
VerticalAlignment = VerticalAlignment.Center,
}
}

8
Windows/Perspex.Win32/PopupImpl.cs

@ -21,7 +21,13 @@ namespace Perspex.Win32
(int)p.Y,
0,
0,
UnmanagedMethods.SetWindowPosFlags.SWP_NOSIZE);
UnmanagedMethods.SetWindowPosFlags.SWP_NOSIZE | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE);
}
public override void Show()
{
UnmanagedMethods.ShowWindow(this.Handle.Handle, UnmanagedMethods.ShowWindowCommand.ShowNoActivate);
}
protected override IntPtr CreateWindowOverride(ushort atom)

4
Windows/Perspex.Win32/WindowImpl.cs

@ -71,8 +71,6 @@ namespace Perspex.Win32
-padding.top + padding.bottom + (int)value.Height,
UnmanagedMethods.SetWindowPosFlags.SWP_RESIZE);
}
System.Diagnostics.Debug.WriteLine("ClientSize = " + value);
}
}
}
@ -128,7 +126,7 @@ namespace Perspex.Win32
UnmanagedMethods.SetWindowText(this.hwnd, title);
}
public void Show()
public virtual void Show()
{
UnmanagedMethods.ShowWindow(this.hwnd, UnmanagedMethods.ShowWindowCommand.Normal);
}

Loading…
Cancel
Save