| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using Avalonia.Controls;
- using Avalonia.Media.Imaging;
- using Avalonia.Platform;
- using ControlCatalog.ViewModels;
- namespace ControlCatalog.Pages
- {
- public partial class TabControlPage : UserControl
- {
- public TabControlPage()
- {
- InitializeComponent();
- DataContext = new TabControlPageViewModel
- {
- Tabs = new[]
- {
- new TabControlPageViewModelItem
- {
- Header = "Arch",
- Text = "This is the first templated tab page.",
- Image = LoadBitmap("avares://ControlCatalog/Assets/delicate-arch-896885_640.jpg"),
- },
- new TabControlPageViewModelItem
- {
- Header = "Leaf",
- Text = "This is the second templated tab page.",
- Image = LoadBitmap("avares://ControlCatalog/Assets/maple-leaf-888807_640.jpg"),
- },
- new TabControlPageViewModelItem
- {
- Header = "Disabled",
- Text = "You should not see this.",
- IsEnabled = false,
- },
- },
- TabPlacement = Dock.Top,
- };
- }
- private static Bitmap LoadBitmap(string uri)
- {
- return new Bitmap(AssetLoader.Open(new Uri(uri)));
- }
- }
- }
|