Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add designer datacontexts #1266

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Bootstrapper/ByfronDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Bootstrapper"
mc:Ignorable="d"
Width="600"
Height="400"
d:DataContext="{d:DesignInstance vms:ByfronDialogViewModel,
IsDesignTimeCreatable=True}"
ResizeMode="NoResize"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Bootstrapper"
mc:Ignorable="d"
Width="420"
MinHeight="0"
d:DataContext="{d:DesignInstance vms:FluentDialogViewModel,
IsDesignTimeCreatable=True}"
SizeToContent="Height"
ResizeMode="NoResize"
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Menu/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
Title="{x:Static resources:Strings.Menu_Title}"
MinWidth="960"
Width="960"
Height="580"
d:DataContext="{d:DesignInstance vms:MainWindowViewModel,
IsDesignTimeCreatable=True}"
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
ExtendsContentIntoTitleBar="True"
WindowBackdropType="Mica"
Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:AboutViewModel,
IsDesignTimeCreatable=True}"
Title="AboutPage"
Scrollable="True">
<StackPanel Margin="0,0,14,14">
Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/AppearancePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="520" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:AppearanceViewModel,
IsDesignTimeCreatable=True}"
Title="AppearancePage"
Scrollable="True">
<StackPanel Margin="0,0,14,14">
Expand Down
5 changes: 3 additions & 2 deletions Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Menu.Pages"
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
d:DataContext="{d:DesignInstance Type=models:BehaviourViewModel}"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:BehaviourViewModel,
IsDesignTimeCreatable=True}"
Title="BehaviourPage"
Scrollable="True">

Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:FastFlagsViewModel,
IsDesignTimeCreatable=True}"
Title="FastFlagsPage"
Scrollable="True"
Loaded="Page_Loaded">
Expand Down
5 changes: 3 additions & 2 deletions Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Menu.Pages"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
xmlns:viewmodels="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
d:DataContext="{d:DesignInstance Type=viewmodels:InstallationViewModel}"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:InstallationViewModel,
IsDesignTimeCreatable=True}"
Title="InstallationPage">

<StackPanel Margin="0,0,14,14">
Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/IntegrationsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:IntegrationsViewModel,
IsDesignTimeCreatable=True}"
Title="IntegrationsPage"
Scrollable="True">
<StackPanel Margin="0,0,14,14">
Expand Down
3 changes: 3 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/ModsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800"
d:DataContext="{d:DesignInstance vms:ModsViewModel,
IsDesignTimeCreatable=True}"
Title="ModsPage"
Scrollable="True">
<StackPanel Margin="0,0,14,14">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ public class BootstrapperDialogViewModel : NotifyPropertyChangedViewModel
public Visibility CancelButtonVisibility => CancelEnabled ? Visibility.Visible : Visibility.Collapsed;

[Obsolete("Do not use this! This is for the designer only.", true)]
public BootstrapperDialogViewModel()
{
_dialog = null!;
}
public BootstrapperDialogViewModel() : this(null!)
{ }

public BootstrapperDialogViewModel(IBootstrapperDialog dialog)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Bloxstrap.UI.ViewModels.Bootstrapper
public class ByfronDialogViewModel : BootstrapperDialogViewModel
{
// Using dark theme for default values.
public ImageSource ByfronLogoLocation { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg"));
public ImageSource ByfronLogoLocation { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Bloxstrap;component/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg"));
public Thickness DialogBorder { get; set; } = new Thickness(0);
public Brush Background { get; set; } = Brushes.Black;
public Brush Foreground { get; set; } = new SolidColorBrush(Color.FromRgb(239, 239, 239));
Expand All @@ -18,6 +18,10 @@ public class ByfronDialogViewModel : BootstrapperDialogViewModel

public string VersionText { get; init; }

[Obsolete("Do not use this! This is for the designer only.", true)]
public ByfronDialogViewModel() : this(null!, "0.611.0.6110432")
{ }

public ByfronDialogViewModel(IBootstrapperDialog dialog, string version) : base(dialog)
{
VersionText = version;
Expand Down
4 changes: 4 additions & 0 deletions Bloxstrap/UI/ViewModels/Bootstrapper/FluentDialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ public class FluentDialogViewModel : BootstrapperDialogViewModel
{
public double FooterOpacity => Environment.OSVersion.Version.Build >= 22000 ? 0.4 : 1;

[Obsolete("Do not use this! This is for the designer only.", true)]
public FluentDialogViewModel() : this(null!)
{ }

public FluentDialogViewModel(IBootstrapperDialog dialog) : base(dialog)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ProgressFluentDialogViewModel : BootstrapperDialogViewModel
public SolidColorBrush BackgroundColourBrush { get; set; } = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

[Obsolete("Do not use this! This is for the designer only.", true)]
public ProgressFluentDialogViewModel() : base()
public ProgressFluentDialogViewModel() : this(null!, false)
{ }

public ProgressFluentDialogViewModel(IBootstrapperDialog dialog, bool aero) : base(dialog)
Expand Down
4 changes: 4 additions & 0 deletions Bloxstrap/UI/ViewModels/Menu/AppearanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ private void BrowseCustomIconLocation()
OnPropertyChanged(nameof(CustomIconLocation));
}

[Obsolete("Do not use this! This is for the designer only.", true)]
public AppearanceViewModel() : this(null!)
{ }

public AppearanceViewModel(Page page)
{
_page = page;
Expand Down
4 changes: 4 additions & 0 deletions Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class FastFlagsViewModel : NotifyPropertyChangedViewModel
{
private readonly Page _page;

[Obsolete("Do not use this! This is for the designer only.", true)]
public FastFlagsViewModel() : this(null!)
{ }

public FastFlagsViewModel(Page page)
{
_page = page;
Expand Down
4 changes: 4 additions & 0 deletions Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public class MainWindowViewModel : NotifyPropertyChangedViewModel
public string ConfirmButtonText => App.IsFirstRun ? Resources.Strings.Menu_Install : Resources.Strings.Menu_Save;
public bool ConfirmButtonEnabled { get; set; } = true;

[Obsolete("Do not use this! This is for the designer only.", true)]
public MainWindowViewModel() : this(null!)
{ }

public MainWindowViewModel(Window window)
{
_window = window;
Expand Down