-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DropdownWindow and standardize window properties
Introduce a new `DropdownWindow` class that uses a custom dropdown control, and standardize the width, height, and startup location properties for all windows. Adjustments in the `Dropdown` control improve type safety and data handling.
- Loading branch information
1 parent
121a731
commit 5814c94
Showing
3 changed files
with
103 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using Frank.Wpf.Controls.SimpleInputs; | ||
|
||
namespace Frank.Wpf.Tests.App.Windows; | ||
|
||
public class DropdownWindow : Window | ||
{ | ||
|
||
private readonly Dropdown<MyClass> _dropdown; | ||
|
||
public DropdownWindow() | ||
{ | ||
_dropdown = new Dropdown<MyClass>() | ||
{ | ||
Items = new List<MyClass> | ||
{ | ||
new MyClass { Id = Guid.NewGuid(), Name = "Frank", Age = 30 }, | ||
new MyClass { Id = Guid.NewGuid(), Name = "John", Age = 40 }, | ||
new MyClass { Id = Guid.NewGuid(), Name = "Jane", Age = 50 } | ||
}, | ||
DisplayFunc = x => x.Name, | ||
SelectionChangedAction = x => { MessageBox.Show($"Selected {x.Name} with Id {x.Id} and Age {x.Age}"); } | ||
}; | ||
|
||
var stackPanel = new StackPanel(); | ||
stackPanel.Children.Add(_dropdown); | ||
|
||
Content = stackPanel; | ||
} | ||
|
||
private class MyClass | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public int Age { get; set; } | ||
} | ||
} |