remove separate initializecomponent call.

This commit is contained in:
Jumar Macato 2023-05-30 23:07:30 +08:00
parent b4690d6158
commit c5e6cbf7bd
54 changed files with 66 additions and 254 deletions

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Browser;
using Avalonia.ReactiveUI;
using ControlCatalogStandalone;
[assembly: SupportedOSPlatform("browser")]
@ -11,7 +10,6 @@ internal partial class Program
{
private static async Task Main(string[] args) => await BuildAvaloniaApp()
.WithInterFont()
.UseReactiveUI()
.StartBrowserAppAsync("out");
public static AppBuilder BuildAvaloniaApp()

View File

@ -10,7 +10,7 @@ namespace ControlCatalogStandalone
{
public DecoratedWindow()
{
this.InitializeComponent();
InitializeComponent();
}
void SetupSide(string name, StandardCursorType cursor, WindowEdge edge)
@ -38,7 +38,7 @@ namespace ControlCatalogStandalone
SetupSide("TopRight", StandardCursorType.TopRightCorner, WindowEdge.NorthEast);
SetupSide("BottomLeft", StandardCursorType.BottomLeftCorner, WindowEdge.SouthWest);
SetupSide("BottomRight", StandardCursorType.BottomRightCorner, WindowEdge.SouthEast);
this.Get<Button>("MinimizeButton").Click += delegate { this.WindowState = WindowState.Minimized; };
this.Get<Button>("MinimizeButton").Click += delegate { WindowState = WindowState.Minimized; };
this.Get<Button>("MaximizeButton").Click += delegate
{
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;

View File

@ -35,9 +35,5 @@ namespace ControlCatalogStandalone
Close();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -11,9 +11,5 @@ namespace ControlCatalogStandalone.Pages
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -11,13 +11,9 @@ namespace ControlCatalogStandalone.Pages
public AdornerLayerPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void RemoveAdorner_OnClick(object? sender, RoutedEventArgs e)
{

View File

@ -107,7 +107,7 @@ namespace ControlCatalogStandalone.Pages
public AutoCompleteBoxPage()
{
this.InitializeComponent();
InitializeComponent();
States = BuildAllStates();
Sentences = BuildAllSentences();
@ -196,10 +196,5 @@ namespace ControlCatalogStandalone.Pages
}
return string.Empty;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,7 @@ namespace ControlCatalogStandalone.Pages
{
public BorderPage()
{
this.InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
InitializeComponent();
}
}
}

View File

@ -10,13 +10,9 @@ namespace ControlCatalogStandalone.Pages
{
public ButtonSpinnerPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public void OnSpin(object sender, SpinEventArgs e)
{

View File

@ -14,10 +14,6 @@ namespace ControlCatalogStandalone.Pages
this.Get<RepeatButton>("RepeatButton").Click += OnRepeatButtonClick;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public void OnRepeatButtonClick(object? sender, object args)
{

View File

@ -28,9 +28,5 @@ namespace ControlCatalogStandalone.Pages
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -8,7 +8,7 @@ namespace ControlCatalogStandalone.Pages
{
public CalendarPage()
{
this.InitializeComponent();
InitializeComponent();
var today = DateTime.Today;
var cal1 = this.Get<Calendar>("DisplayDatesCalendar");
@ -20,9 +20,5 @@ namespace ControlCatalogStandalone.Pages
cal2.BlackoutDates.Add(new CalendarDateRange(today.AddDays(6)));
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public CanvasPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public CheckBoxPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -23,10 +23,6 @@ namespace ControlCatalogStandalone.Pages
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private async void CopyText(object? sender, RoutedEventArgs args)
{
@ -110,7 +106,7 @@ namespace ControlCatalogStandalone.Pages
{
if (TopLevel.GetTopLevel(this)?.Clipboard is { } clipboard)
{
var files = await clipboard.GetDataAsync(DataFormats.Files) as IEnumerable<Avalonia.Platform.Storage.IStorageItem>;
var files = await clipboard.GetDataAsync(DataFormats.Files) as IEnumerable<IStorageItem>;
ClipboardContent.Text = files != null ? string.Join(Environment.NewLine, files.Select(f => f.TryGetLocalPath() ?? f.Name)) : string.Empty;
}

View File

@ -28,9 +28,5 @@ namespace ControlCatalogStandalone.Pages
layoutRoot.Children.Add(colorPicker);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -10,7 +10,7 @@ namespace ControlCatalogStandalone.Pages
{
public ComboBoxPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new ComboBoxPageViewModel();
}

View File

@ -84,9 +84,5 @@ namespace ControlCatalogStandalone.Pages
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -12,7 +12,7 @@ namespace ControlCatalogStandalone.Pages
{
public ContextMenuPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new ContextPageViewModel();
var customContextRequestedBorder = this.Get<Border>("CustomContextRequestedBorder");
@ -62,9 +62,5 @@ namespace ControlCatalogStandalone.Pages
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -8,13 +8,9 @@ namespace ControlCatalogStandalone.Pages
{
public CursorPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new CursorPageViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -120,26 +120,26 @@ namespace ControlCatalogStandalone.Pages
public override void Render(DrawingContext context)
{
var localBounds = new Rect(new Size(this.Bounds.Width, this.Bounds.Height));
var clip = context.PushClip(this.Bounds);
var localBounds = new Rect(new Size(Bounds.Width, Bounds.Height));
var clip = context.PushClip(Bounds);
context.DrawRectangle(Brushes.White, _pen, localBounds, 1.0d);
var halfMax = Math.Max(this.Bounds.Width / 2.0d, this.Bounds.Height / 2.0d) * Math.Sqrt(2.0d);
var halfMin = Math.Min(this.Bounds.Width / 2.0d, this.Bounds.Height / 2.0d) / 1.3d;
var halfWidth = this.Bounds.Width / 2.0d;
var halfHeight = this.Bounds.Height / 2.0d;
var halfMax = Math.Max(Bounds.Width / 2.0d, Bounds.Height / 2.0d) * Math.Sqrt(2.0d);
var halfMin = Math.Min(Bounds.Width / 2.0d, Bounds.Height / 2.0d) / 1.3d;
var halfWidth = Bounds.Width / 2.0d;
var halfHeight = Bounds.Height / 2.0d;
// 0,0 refers to the top-left of the control now. It is not prime time to draw gui stuff because it'll be under the world
var translateModifier = context.PushTransform(Avalonia.Matrix.CreateTranslation(new Avalonia.Vector(halfWidth, halfHeight)));
var translateModifier = context.PushTransform(Matrix.CreateTranslation(new Vector(halfWidth, halfHeight)));
// now 0,0 refers to the ViewportCenter(X,Y).
var rotationMatrix = Avalonia.Matrix.CreateRotation(Rotation);
var rotationMatrix = Matrix.CreateRotation(Rotation);
var rotationModifier = context.PushTransform(rotationMatrix);
// everything is rotated but not scaled
var scaleModifier = context.PushTransform(Avalonia.Matrix.CreateScale(Scale, -Scale));
var scaleModifier = context.PushTransform(Matrix.CreateScale(Scale, -Scale));
var mapPositionModifier = context.PushTransform(Matrix.CreateTranslation(new Vector(-ViewportCenterX, -ViewportCenterY)));
@ -188,7 +188,7 @@ namespace ControlCatalogStandalone.Pages
private Point UIPointToWorldPoint(Point inPoint, double viewportCenterX, double viewportCenterY, double scale, double rotation)
{
Point workingPoint = new Point(inPoint.X, -inPoint.Y);
workingPoint += new Vector(-this.Bounds.Width / 2.0d, this.Bounds.Height / 2.0d);
workingPoint += new Vector(-Bounds.Width / 2.0d, Bounds.Height / 2.0d);
workingPoint /= scale;
workingPoint = Matrix.CreateRotation(rotation).Transform(workingPoint);
@ -206,7 +206,7 @@ namespace ControlCatalogStandalone.Pages
// undo rotation
workingPoint = Matrix.CreateRotation(-rotation).Transform(workingPoint);
workingPoint *= scale;
workingPoint -= new Vector(-this.Bounds.Width / 2.0d, this.Bounds.Height / 2.0d);
workingPoint -= new Vector(-Bounds.Width / 2.0d, Bounds.Height / 2.0d);
workingPoint = new Point(workingPoint.X, -workingPoint.Y);
return workingPoint;

View File

@ -17,7 +17,7 @@ namespace ControlCatalogStandalone.Pages
{
public DataGridPage()
{
this.InitializeComponent();
InitializeComponent();
var dataGridSortDescription = DataGridSortDescription.FromPath(nameof(Country.Region), ListSortDirection.Ascending, new ReversedStringComparer());
var collectionView1 = new DataGridCollectionView(Countries.All);
@ -70,10 +70,6 @@ namespace ControlCatalogStandalone.Pages
e.Row.Header = e.Row.GetIndex() + 1;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private class ReversedStringComparer : IComparer<object>, IComparer
{

View File

@ -8,7 +8,7 @@ namespace ControlCatalogStandalone.Pages
{
public DateTimePickerPage()
{
this.InitializeComponent();
InitializeComponent();
this.Get<TextBlock>("DatePickerDesc").Text = "Use a DatePicker to let users set a date in your app, " +
"for example to schedule an appointment. The DatePicker displays three controls for month, day, and year. " +
"These controls are easy to use with touch or mouse, and they can be styled and configured in several different ways. " +
@ -22,9 +22,5 @@ namespace ControlCatalogStandalone.Pages
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -22,7 +22,7 @@ namespace ControlCatalogStandalone.Pages
{
public DialogsPage()
{
this.InitializeComponent();
InitializeComponent();
IStorageFolder? lastSelectedDirectory = null;
bool ignoreTextChanged = false;
@ -439,10 +439,6 @@ CanPickFolder: {storageProvider.CanPickFolder}";
Window GetWindow() => TopLevel.GetTopLevel(this) as Window ?? throw new NullReferenceException("Invalid Owner");
TopLevel GetTopLevel() => TopLevel.GetTopLevel(this) ?? throw new NullReferenceException("Invalid Owner");
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
#pragma warning restore CS0618 // Type or member is obsolete

View File

@ -14,7 +14,7 @@ namespace ControlCatalogStandalone.Pages
private const string CustomFormat = "application/xxx-avalonia-ControlCatalogStandalone-custom";
public DragAndDropPage()
{
this.InitializeComponent();
InitializeComponent();
_dropState = this.Get<TextBlock>("DropState");
int textCount = 0;
@ -30,7 +30,7 @@ namespace ControlCatalogStandalone.Pages
var dragMe = this.Get<Border>("DragMe" + suffix);
var dragState = this.Get<TextBlock>("DragState" + suffix);
async void DoDrag(object? sender, Avalonia.Input.PointerPressedEventArgs e)
async void DoDrag(object? sender, PointerPressedEventArgs e)
{
var dragData = new DataObject();
factory(dragData);
@ -133,9 +133,5 @@ namespace ControlCatalogStandalone.Pages
AddHandler(DragDrop.DragOverEvent, DragOver);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -8,7 +8,7 @@ namespace ControlCatalogStandalone.Pages
{
public ExpanderPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new ExpanderPageViewModel();
var CollapsingDisabledExpander = this.Get<Expander>("CollapsingDisabledExpander");
@ -18,9 +18,5 @@ namespace ControlCatalogStandalone.Pages
ExpandingDisabledExpander.Expanding += (s, e) => { e.Cancel = true; };
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -17,13 +17,9 @@ namespace ControlCatalogStandalone.Pages
public GesturePage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
@ -185,7 +181,7 @@ namespace ControlCatalogStandalone.Pages
InitComposition(ball!);
if (ballCompositionVisual != null)
{
ballCompositionVisual.Offset = defaultOffset + new System.Numerics.Vector3((float)e.Delta.X * 0.4f, (float)e.Delta.Y * 0.4f, 0) * (inverse ? -1 : 1);
ballCompositionVisual.Offset = defaultOffset + new Vector3((float)e.Delta.X * 0.4f, (float)e.Delta.Y * 0.4f, 0) * (inverse ? -1 : 1);
e.Handled = true;
}

View File

@ -22,10 +22,6 @@ namespace ControlCatalogStandalone.Pages
_croppedImage = this.Get<Image>("croppedImage");
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public void BitmapStretchChanged(object sender, SelectionChangedEventArgs e)
{

View File

@ -10,7 +10,7 @@ namespace ControlCatalogStandalone.Pages
public LabelsPage()
{
CreateDefaultPerson();
this.InitializeComponent();
InitializeComponent();
}
private void CreateDefaultPerson()

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public LayoutTransformControlPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -12,9 +12,5 @@ namespace ControlCatalogStandalone.Pages
DataContext = new ListBoxPageViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -12,14 +12,10 @@ namespace ControlCatalogStandalone.Pages
{
public MenuPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new MenuPageViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private MenuPageViewModel? _model;
protected override void OnDataContextChanged(EventArgs e)

View File

@ -15,13 +15,9 @@ namespace ControlCatalogStandalone.Pages
{
public NativeEmbedPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public async void ShowPopupDelay(object sender, RoutedEventArgs args)
{

View File

@ -11,17 +11,13 @@ namespace ControlCatalogStandalone.Pages
public NotificationsPage()
{
this.InitializeComponent();
InitializeComponent();
_viewModel = new NotificationViewModel();
DataContext = _viewModel;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{

View File

@ -13,15 +13,11 @@ namespace ControlCatalogStandalone.Pages
{
public NumericUpDownPage()
{
this.InitializeComponent();
InitializeComponent();
var viewModel = new NumbersPageViewModel();
DataContext = viewModel;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public static IValueConverter CultureConverter =
new FuncValueConverter<CultureInfo, NumberFormatInfo>(c => (c ?? CultureInfo.CurrentCulture).NumberFormat);
@ -44,13 +40,13 @@ namespace ControlCatalogStandalone.Pages
public double DoubleValue
{
get { return _doubleValue; }
set { this.RaiseAndSetIfChanged(ref _doubleValue, value); }
set { RaiseAndSetIfChanged(ref _doubleValue, value); }
}
public decimal DecimalValue
{
get { return _decimalValue; }
set { this.RaiseAndSetIfChanged(ref _decimalValue, value); }
set { RaiseAndSetIfChanged(ref _decimalValue, value); }
}
public IList<FormatObject> Formats
@ -93,7 +89,7 @@ namespace ControlCatalogStandalone.Pages
public FormatObject? SelectedFormat
{
get { return _selectedFormat; }
set { this.RaiseAndSetIfChanged(ref _selectedFormat, value); }
set { RaiseAndSetIfChanged(ref _selectedFormat, value); }
}
}

View File

@ -11,13 +11,9 @@ namespace ControlCatalogStandalone.Pages
{
public PlatformInfoPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new PlatformInformationViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -9,7 +9,7 @@ public partial class PointersPage : UserControl
{
public PointersPage()
{
this.InitializeComponent();
InitializeComponent();
var border1 = this.Get<Border>("BorderCapture1");
var border2 = this.Get<Border>("BorderCapture2");

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public ProgressBarPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public RadioButtonPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -49,25 +49,25 @@ namespace ControlCatalogStandalone.Pages
public bool AllowAutoHide
{
get => _allowAutoHide;
set => this.RaiseAndSetIfChanged(ref _allowAutoHide, value);
set => RaiseAndSetIfChanged(ref _allowAutoHide, value);
}
public bool EnableInertia
{
get => _enableInertia;
set => this.RaiseAndSetIfChanged(ref _enableInertia, value);
set => RaiseAndSetIfChanged(ref _enableInertia, value);
}
public ScrollBarVisibility HorizontalScrollVisibility
{
get => _horizontalScrollVisibility;
set => this.RaiseAndSetIfChanged(ref _horizontalScrollVisibility, value);
set => RaiseAndSetIfChanged(ref _horizontalScrollVisibility, value);
}
public ScrollBarVisibility VerticalScrollVisibility
{
get => _verticalScrollVisibility;
set => this.RaiseAndSetIfChanged(ref _verticalScrollVisibility, value);
set => RaiseAndSetIfChanged(ref _verticalScrollVisibility, value);
}
public List<ScrollBarVisibility> AvailableVisibility { get; }
@ -75,19 +75,19 @@ namespace ControlCatalogStandalone.Pages
public bool AreSnapPointsRegular
{
get => _areSnapPointsRegular;
set => this.RaiseAndSetIfChanged(ref _areSnapPointsRegular, value);
set => RaiseAndSetIfChanged(ref _areSnapPointsRegular, value);
}
public SnapPointsType SnapPointsType
{
get => _snapPointsType;
set => this.RaiseAndSetIfChanged(ref _snapPointsType, value);
set => RaiseAndSetIfChanged(ref _snapPointsType, value);
}
public SnapPointsAlignment SnapPointsAlignment
{
get => _snapPointsAlignment;
set => this.RaiseAndSetIfChanged(ref _snapPointsAlignment, value);
set => RaiseAndSetIfChanged(ref _snapPointsAlignment, value);
}
public List<SnapPointsType> AvailableSnapPointsType { get; }
public List<SnapPointsAlignment> AvailableSnapPointsAlignment { get; }
@ -102,9 +102,5 @@ namespace ControlCatalogStandalone.Pages
DataContext = new ScrollViewerPageViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public SliderPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -9,13 +9,9 @@ namespace ControlCatalogStandalone.Pages
{
public SplitViewPage()
{
this.InitializeComponent();
InitializeComponent();
DataContext = new SplitViewPageViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -44,10 +44,6 @@ namespace ControlCatalogStandalone.Pages
};
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private static Bitmap LoadBitmap(string uri)
{

View File

@ -31,9 +31,5 @@ namespace ControlCatalogStandalone.Pages
};
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public TextBlockPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public TextBoxPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -8,12 +8,8 @@ namespace ControlCatalogStandalone.Pages
{
public ToggleSwitchPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Pages
{
public ToolTipPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -11,9 +11,5 @@ namespace ControlCatalogStandalone.Pages
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -12,9 +12,5 @@ namespace ControlCatalogStandalone.Pages
DataContext = new TreeViewPageViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -10,9 +10,5 @@ namespace ControlCatalogStandalone.Pages
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -8,12 +8,8 @@ namespace ControlCatalogStandalone.Pages
{
public WindowCustomizationsPage()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View File

@ -36,7 +36,7 @@ namespace ControlCatalogStandalone.ViewModels
{
var dialog = new AboutAvaloniaDialog();
if ((App.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow is
if ((Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow is
{ } mainWindow)
{
await dialog.ShowDialog(mainWindow);
@ -44,7 +44,7 @@ namespace ControlCatalogStandalone.ViewModels
});
ExitCommand = MiniCommand.Create(() =>
{
(App.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.Shutdown();
(Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.Shutdown();
});
ToggleMenuItemCheckedCommand = MiniCommand.Create(() => { IsMenuItemChecked = !IsMenuItemChecked; });

View File

@ -16,22 +16,22 @@ namespace ControlCatalogStandalone.ViewModels
ShowManagedNotificationCommand = MiniCommand.Create(() =>
{
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information));
NotificationManager?.Show(new Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information));
});
ShowNativeNotificationCommand = MiniCommand.Create(() =>
{
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error));
NotificationManager?.Show(new Notification("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error));
});
YesCommand = MiniCommand.Create(() =>
{
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today."));
NotificationManager?.Show(new Notification("Avalonia Notifications", "Start adding notifications to your app today."));
});
NoCommand = MiniCommand.Create(() =>
{
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
NotificationManager?.Show(new Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
});
}

View File

@ -7,12 +7,8 @@ namespace ControlCatalogStandalone.Views
{
public CustomNotificationView()
{
this.InitializeComponent();
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}