5 changed files with 141 additions and 59 deletions
@ -1,18 +1,47 @@ |
|||||
using Avalonia.Controls; |
using Avalonia.Controls; |
||||
using Avalonia.Markup.Xaml; |
using Avalonia.Markup.Xaml; |
||||
|
using Avalonia.Media; |
||||
|
|
||||
namespace ControlCatalog.Pages |
namespace ControlCatalog.Pages |
||||
{ |
{ |
||||
public class ViewboxPage : UserControl |
public class ViewboxPage : UserControl |
||||
{ |
{ |
||||
|
private readonly Viewbox _viewbox; |
||||
|
private readonly ComboBox _stretchSelector; |
||||
|
|
||||
public ViewboxPage() |
public ViewboxPage() |
||||
{ |
{ |
||||
this.InitializeComponent(); |
InitializeComponent(); |
||||
|
|
||||
|
_viewbox = this.FindControl<Viewbox>("Viewbox"); |
||||
|
|
||||
|
_stretchSelector = this.FindControl<ComboBox>("StretchSelector"); |
||||
|
|
||||
|
_stretchSelector.Items = new[] |
||||
|
{ |
||||
|
Stretch.Uniform, Stretch.UniformToFill, Stretch.Fill, Stretch.None |
||||
|
}; |
||||
|
|
||||
|
_stretchSelector.SelectedIndex = 0; |
||||
|
|
||||
|
var stretchDirectionSelector = this.FindControl<ComboBox>("StretchDirectionSelector"); |
||||
|
|
||||
|
stretchDirectionSelector.Items = new[] |
||||
|
{ |
||||
|
StretchDirection.Both, StretchDirection.DownOnly, StretchDirection.UpOnly |
||||
|
}; |
||||
|
|
||||
|
stretchDirectionSelector.SelectedIndex = 0; |
||||
} |
} |
||||
|
|
||||
private void InitializeComponent() |
private void InitializeComponent() |
||||
{ |
{ |
||||
AvaloniaXamlLoader.Load(this); |
AvaloniaXamlLoader.Load(this); |
||||
} |
} |
||||
|
|
||||
|
private void StretchSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) |
||||
|
{ |
||||
|
_viewbox.Stretch = (Stretch) _stretchSelector.SelectedItem!; |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue