-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from irihitech/ElasticWrapPanel
Add ElasticWrapPanel control
- Loading branch information
Showing
9 changed files
with
874 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
using Avalonia.Controls; | ||
using Ursa.Demo.ViewModels; | ||
|
||
namespace Ursa.Demo.Pages; | ||
|
||
public partial class ElasticWrapPanelDemo : UserControl | ||
{ | ||
public ElasticWrapPanelDemo() | ||
{ | ||
InitializeComponent(); | ||
DataContext = new ElasticWrapPanelDemoViewModel(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
demo/Ursa.Demo/ViewModels/ElasticWrapPanelDemoViewModel.cs
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,54 @@ | ||
using Avalonia.Controls.Primitives; | ||
using Avalonia.Layout; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
|
||
namespace Ursa.Demo.ViewModels; | ||
|
||
public partial class ElasticWrapPanelDemoViewModel : ObservableObject | ||
{ | ||
[ObservableProperty] private Orientation _selectedOrientation = Orientation.Horizontal; | ||
[ObservableProperty] private ScrollBarVisibility _horizontalVisibility = ScrollBarVisibility.Auto; | ||
[ObservableProperty] private ScrollBarVisibility _verticalVisibility = ScrollBarVisibility.Auto; | ||
|
||
[ObservableProperty] private bool _isFillHorizontal; | ||
[ObservableProperty] private bool _isFillVertical; | ||
[ObservableProperty] private double _itemWidth = 40d; | ||
[ObservableProperty] private double _itemHeight = 40d; | ||
|
||
[ObservableProperty] private bool _autoWidth = true; | ||
[ObservableProperty] private bool _autoHeight = true; | ||
[ObservableProperty] private double _itemSelfWidth = double.NaN; | ||
[ObservableProperty] private double _itemSelfHeight = double.NaN; | ||
|
||
[ObservableProperty] private HorizontalAlignment _cmbHAlign = HorizontalAlignment.Left; | ||
[ObservableProperty] private VerticalAlignment _cmbVAlign = VerticalAlignment.Stretch; | ||
|
||
private double _oldItemSelfWidth; | ||
private double _oldItemSelfHeight; | ||
|
||
partial void OnAutoWidthChanged(bool value) | ||
{ | ||
if (value) | ||
{ | ||
_oldItemSelfWidth = ItemSelfWidth; | ||
ItemSelfWidth = double.NaN; | ||
} | ||
else | ||
{ | ||
ItemSelfWidth = _oldItemSelfWidth; | ||
} | ||
} | ||
|
||
partial void OnAutoHeightChanged(bool value) | ||
{ | ||
if (value) | ||
{ | ||
_oldItemSelfHeight = ItemSelfHeight; | ||
ItemSelfHeight = double.NaN; | ||
} | ||
else | ||
{ | ||
ItemSelfHeight = _oldItemSelfHeight; | ||
} | ||
} | ||
} |
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,3 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
</ResourceDictionary> |
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
Oops, something went wrong.