Dependency Injection + MVVM?

I followed a Tim Corey tutorial on Dependency Injection in WPF but he did not use MVVM just raw code behind. How hard would be to switch over to MVVM? I just want an app where I have a MainView, SettingsView, and a few other Views. He uses Interfaces, etc and I'm lost. :< What should I do?
247 Replies
Core Dream Studios
I hate confusion, bad enough MVVM can be confusing sometimes for me lol
lycian
lycian2w ago
IMO switching to MVVM just for the sake of it on a small app would only be useful to learn. That said, if you already have DI, it shouldn't be that hard to do
Core Dream Studios
i know mvvm but i dunno how to impliment tim corey's di as it's bad practice what he did apparently :/ maybe i will just do the MVVM part and post my code later if someone wants to help me with the DI part XD i cant fiddle with unknowns when i need to make something fast its why i keep going to winforms, it just works :x
Core Dream Studios
IAmTimCorey
YouTube
Dependency Injection in WPF in .NET 6 Including the Factory Pattern
.NET Core has a built-in dependency injection that we use in every web project type we create. However, did you know that you can also use that same dependency injection in the .NET Core version of WPF? In this video, we are going to enable dependency injection in WPF and then use it for some common scenarios, including creating multiple forms. ...
Core Dream Studios
i used his DI setup but its for non-mvvm i know some mvvm but iam not good at combining ideas into 1, autism sucks 😦 so i always get stuck with concepts
Core Dream Studios
I added the common Models, ViewModels, Views folder added CommunityToolkit.MVVM as well etc so i got that far 😄
leowest
leowest2w ago
push to github and post link 😉
Core Dream Studios
wheee i gotta make a new ssh, sec pushing https://github.com/coredreamstudios/TitanSTUDIO yay 😄 ignore the MainView.xaml window, i renamed the original to MainViewDI.xaml so i can work on my UI while i wait
leowest
leowest2w ago
u forgot to set it pub
Core Dream Studios
i cant keep it private? sec
leowest
leowest2w ago
if u keep it private then u have to invite people in order for them to see it
Core Dream Studios
done
leowest
leowest2w ago
leowest77
Core Dream Studios
its now public
lycian
lycian2w ago
In the toolkit MVVM samples they have basically what you're looking for https://github.com/CommunityToolkit/MVVM-Samples/blob/master/samples/MvvmSampleUwp/App.xaml.cs#L56
GitHub
MVVM-Samples/samples/MvvmSampleUwp/App.xaml.cs at master · Communit...
Sample repo for MVVM package. Contribute to CommunityToolkit/MVVM-Samples development by creating an account on GitHub.
lycian
lycian2w ago
They add the viewmodels as transient in the container, the views can then either: be added to the container, or get the view model from the container it uses UWP but the same applies for WPF
leowest
leowest2w ago
@Core Dream Studios a lot of the things u have in your viewdi, will go in the viewmodel or are the 2 different windows?
Core Dream Studios
minus the _click's of course as we will use ICommand's right?
leowest
leowest2w ago
some of the ui events would become commands yes
Core Dream Studios
not sure why tim made child forms like that
leowest
leowest2w ago
but imagine for example if u wanted to load something when the window loads
Core Dream Studios
you cant customize em as they're all the same XD
leowest
leowest2w ago
then what we often do is we wire it from the view to the vm
Core Dream Studios
yep, that i understand do i even need factories? i dont even know wth those even are XD i only did what he did
leowest
leowest2w ago
u may use factories in some scenarios but for a simple app at the level u are right now u shouldn't have to worry about it all u have are either singleton or scoped stuff
Core Dream Studios
my app is very simple, all it will do is write/read files, and ram addresses, nothing special no web, etc
leowest
leowest2w ago
its worth learning about the lifecycle of things so u understand which one u should use
Core Dream Studios
singleton i know means a window/form which you use once, aka the main one that i get the transient means more than 1 use according to what tim said
leowest
leowest2w ago
singleton will live trhu the entire duration of the app
Core Dream Studios
im gonna try to update my code to reflect the DI with MVVM then push changes to github yes, aka main window 🙂
leowest
leowest2w ago
also u added CTK but you're not using it u still have INPC stuff
Core Dream Studios
CTK?
leowest
leowest2w ago
CommunityToolkit abbrev
Core Dream Studios
yeah i didnt switch over yet was doing some raw basic stuff for now but gonna switch in a minute i will update my github in 20min
leowest
leowest2w ago
its ok im just going thru what is in there for now and seeing what changes are required to plug mvvm with di
Core Dream Studios
that code behind Tim did with the Main .xaml, thats bad practice for mvvm for sure
leowest
leowest2w ago
yes because it mix view with things that aren't view
Core Dream Studios
i think datacontext would be best here
leowest
leowest2w ago
DataContext would still live in the view althou u can also set it via di initialization
leowest
leowest2w ago
the concept of DI is
No description
leowest
leowest2w ago
you have an object with a dependency when that object is initialize DI will query its setvices and see if it have an instance it can fullfil that dependency so it looks up oh I have a singleton MainViewModel, let me pass it via that constructor
Core Dream Studios
i will see how far i can get now, will update github when done 🙂
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Windows;
using TitanSTUDIO.Views;
using SampleWpfLibrary;
using TitanSTUDIO.StartupHelpers;

namespace TitanSTUDIO;

public partial class App : Application
{
public static IHost? AppHost { get; private set; }

public App()
{
AppHost = Host.CreateDefaultBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddSingleton<MainViewDI>();
services.AddViewFactory<ChildView>();
services.AddTransient<IDataAccess, DataAccess>();
})
.Build();
}

protected override async void OnStartup(StartupEventArgs e)
{
await AppHost!.StartAsync();

var startupForm = AppHost.Services.GetRequiredService<MainViewDI>();
startupForm.Show();

base.OnStartup(e);
}

protected override async void OnExit(ExitEventArgs e)
{
await AppHost!.StopAsync();

base.OnExit(e);
}
}
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Windows;
using TitanSTUDIO.Views;
using SampleWpfLibrary;
using TitanSTUDIO.StartupHelpers;

namespace TitanSTUDIO;

public partial class App : Application
{
public static IHost? AppHost { get; private set; }

public App()
{
AppHost = Host.CreateDefaultBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddSingleton<MainViewDI>();
services.AddViewFactory<ChildView>();
services.AddTransient<IDataAccess, DataAccess>();
})
.Build();
}

protected override async void OnStartup(StartupEventArgs e)
{
await AppHost!.StartAsync();

var startupForm = AppHost.Services.GetRequiredService<MainViewDI>();
startupForm.Show();

base.OnStartup(e);
}

protected override async void OnExit(ExitEventArgs e)
{
await AppHost!.StopAsync();

base.OnExit(e);
}
}
i guess i iwll delete this as its not mvvm
leowest
leowest2w ago
that is
leowest
leowest2w ago
part of it at least I will update u in a bit
leowest
leowest2w ago
No description
Core Dream Studios
i dont understand why he did child view/forms like he did since you cant modify them individually XD like ui etc
leowest
leowest2w ago
well I did not watch his video he must have a reason but it all depends how the childs will be used
Core Dream Studios
but i dont want a cookie cutter child form each window will have its own look tbh for me aka SettingsView
leowest
leowest2w ago
No description
leowest
leowest2w ago
also u realize button have a control called Content where u can write Button 2 instead of wrapping a textblock right?
Core Dream Studios
oh, yeah , i know, im doing it in a rush so i can focus on the mvvm/di first
leowest
leowest2w ago
well normally wpf is not designed to have multiple windows like winforms u can
Core Dream Studios
i also need to do templating which is not needed right now
leowest
leowest2w ago
but usually you have a navigation using usercontrols that swap to different locations
Core Dream Studios
so wouldnt i use pages then?
leowest
leowest2w ago
with that one window u have
Core Dream Studios
err user controls
leowest
leowest2w ago
UserControls is fine I dont ever recall ever using Pages with WPF maybe once to explain it to some one about the navigation system they have in the docs but that was it
Core Dream Studios
pages is more of a ASP.NET / Blazor thing im sure but yes i can do Main and UC and use the child style he did welp i got a lot to work on before i can upload a updated code base so probably wont be for a hour or more XD now with user controls those also will need viewmodels right? based on what they will do each SettingsUserControlViewModel etc?
leowest
leowest2w ago
some will yes u dont need to append UserControl to the name
leowest
leowest2w ago
just SettingView/ViewModel
Core Dream Studios
ty I will update here when i got something useful to show thank you @leowest 🙂
leowest
leowest2w ago
np another thing is that ur not using binding at all
Core Dream Studios
yeah i know
leowest
leowest2w ago
I assume because u were copying Tim's stuff
Core Dream Studios
i was doing raw im switchingt to mvvm now yes 🙂 MVVM = ❤️
leowest
leowest2w ago
leowest
leowest2w ago
so ChildView becomes UserControl from Window via xaml I added a 3rd grid where I have a ControlControl to show the childview inside
<ContentControl Grid.Row="1" Content="{Binding Child}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:ChildViewModel}">
<local:ChildView />
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
<ContentControl Grid.Row="1" Content="{Binding Child}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:ChildViewModel}">
<local:ChildView />
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
Core Dream Studios
ControlControl? oh
leowest
leowest2w ago
the datatemplate defines the vm for the childview do I dont need to wire anything on the View of Child DI will do it all by it self
Core Dream Studios
the buttons werent meant to be on top tbh i was gonna do something gamified
leowest
leowest2w ago
it doesn't matter its just to show how it all wires nad works its fine
Core Dream Studios
oh ok
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SampleWpfLibrary;
using System.Windows;
using TitanSTUDIO.ViewModels;
using TitanSTUDIO.Views;

namespace TitanSTUDIO;

public partial class App : Application
{
public static IHost? AppHost { get; private set; }

public App()
{
AppHost = Host.CreateDefaultBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddTransient<IDataAccess, DataAccess>();
// services.AddScoped<ChildViewModel>();
// services.AddScoped<ChildView>();
services.AddSingleton<MainViewModel>();
services.AddSingleton<MainView>();
}).Build();
}
}
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SampleWpfLibrary;
using System.Windows;
using TitanSTUDIO.ViewModels;
using TitanSTUDIO.Views;

namespace TitanSTUDIO;

public partial class App : Application
{
public static IHost? AppHost { get; private set; }

public App()
{
AppHost = Host.CreateDefaultBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddTransient<IDataAccess, DataAccess>();
// services.AddScoped<ChildViewModel>();
// services.AddScoped<ChildView>();
services.AddSingleton<MainViewModel>();
services.AddSingleton<MainView>();
}).Build();
}
}
i should of kept the overrides? i removed them (not focused on child atm its why I commented it out)
leowest
leowest2w ago
its ok u do u im just showing what u have wired what it would could look like
Core Dream Studios
well now my window wont even load
leowest
leowest2w ago
so that contentcontrol I showed u above I can easily add more templates to it of different childs
Core Dream Studios
so i probably will need the overrides on OnStartup etcc
leowest
leowest2w ago
and swap it via the vm
Core Dream Studios
thats fair
leowest
leowest2w ago
No description
Core Dream Studios
<Application x:Class="TitanSTUDIO.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TitanSTUDIO">
<Application.Resources>

</Application.Resources>
</Application>
<Application x:Class="TitanSTUDIO.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TitanSTUDIO">
<Application.Resources>

</Application.Resources>
</Application>
leowest
leowest2w ago
Child is what is bound to the contentcontrol
Core Dream Studios
i removed the startupwindow as tim said to do
leowest
leowest2w ago
yes u have to since u wire it from the app.xaml.cs
Core Dream Studios
ok but how to i load it now? i removed the OnStartup/OnExit oh ok, so same way got it so many variables 😂
leowest
leowest2w ago
yeah what is in the app.xaml.cs is basic setup for the di it doesnt really change much
Core Dream Studios
im gonna make a base template out of this project im sure i can save it as a Project Template yay
Core Dream Studios
<StatusBar Grid.Row="1" Background="#222" Foreground="WhiteSmoke"> <StatusBarItem Margin="20 5" Content="{Binding Version}"/> <StatusBarItem Margin="20 5" Content="Item 2"/> <StatusBarItem Margin="20 5" Content="Item 3"/> </StatusBar> and bind works 🙂 I think I'm getting somewhere ( I didn't do templating, its why you see margin repeating 😄 ) So... Interfaces, is basically like how C++ has header files? you have the main class then a interface which refers to the methods? I will just read the msdn docs on those
leowest
leowest2w ago
no interfaces are like contracts c++ often split the signature in a header file and the method in the cpp file i.e.: signature
private void GetData();
private void GetData();
leowest
leowest2w ago
to illustrate what I was saying earlier
leowest
leowest2w ago
<ContentControl Grid.Row="1" Content="{Binding Child}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:ChildViewModel}">
<local:ChildView />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:Child2ViewModel}">
<local:ChildView2 />
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
<ContentControl Grid.Row="1" Content="{Binding Child}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:ChildViewModel}">
<local:ChildView />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:Child2ViewModel}">
<local:ChildView2 />
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
I can easily swap between child a and b where button 1 is accessing your data
Core Dream Studios
as long as each child, has its own uI since im gonna many, one for settings with comboboxes, buttons, textboxes etc. and others with similar but for other roles
leowest
leowest2w ago
if you have a UserControl you could just add it to your xaml using say
<local:SomeUserControl />
<local:SomeUserControl />
this would make so it inherits the datacontext from the parent, so if the parent was MainViewModel, it inherits it. however if u define a DataTemplate with a specific ViewModel it will be given that
leowest
leowest2w ago
the datatemplate is also what allows u to use the BaseViewModel as a type to render the View instead of having to use the View and wire everything
Core Dream Studios
Getting overwhelmed but trying
leowest
leowest2w ago
well I will just leave u to it once u finish doing your thing and update let me know and I will take a look again
Core Dream Studios
thank you, def getting somewhere 🙂 almost got it going XD i can't get this to work with UserControls so far
leowest
leowest2w ago
its ok do the rest first get the rest working and then u can go into that
Core Dream Studios
oh, was trying to load up the usercontrol i made XD hrm
Core Dream Studios
my code didn't update on the github XD im getting sloppy 😦
leowest
leowest2w ago
did u forget to set the upstream or something check what origin/master are set to
Core Dream Studios
its not letting me push i think even though i told it too if i switch to origin/master on remote and try i get this
leowest
leowest2w ago
did u commit and then push also that is not what I meant by check master/origin check what its set to sometimes its set to local so it may not be pushing to github
leowest
leowest2w ago
that doesnt tell u what master is set to
Core Dream Studios
where am i not looking?
leowest
leowest2w ago
git remote show origin for example
Core Dream Studios
ok F:\Backups\Backup-DevDrive\source\csharp\wpf\TitanSTUDIO>git remote show origin 'git' is not recognized as an internal or external command, operable program or batch file. ugh im getting stupid, timeout for tonight i guess
leowest
leowest2w ago
:catlaugh:
Core Dream Studios
i will install git
leowest
leowest2w ago
looks like u dont have git installed outside the dev env or something
Core Dream Studios
yeah, i hardly used it til now, i will install
leowest
leowest2w ago
sometimes its easier to get the info via cli
leowest
leowest2w ago
u have a typo ah nvm u fixed after git push origin master:master
Core Dream Studios
no change
leowest
leowest2w ago
yeah I dunno it looks fine visually maybe zip it to save the changes and try to git push origin I assume those changes u showed in the window were commited right git commit -m "Additional changes" if they were this could should say there is no changes or w/e
Core Dream Studios
let me do this, brb
leowest
leowest2w ago
ah u didnt set that up on visual studio
Core Dream Studios
not surprised 😂 we good now
Core Dream Studios
GitHub
TitanSTUDIO/TitanSTUDIO at master · coredreamstudios/TitanSTUDIO
Contribute to coredreamstudios/TitanSTUDIO development by creating an account on GitHub.
leowest
leowest2w ago
u dont need to do
private string _version = "1.00";
public string Version
{
get => _version;
set => SetProperty(ref _version, value);
}
private string _version = "1.00";
public string Version
{
get => _version;
set => SetProperty(ref _version, value);
}
Core Dream Studios
that was just for testing
leowest
leowest2w ago
u can just do
[ObservableProperty]
private string _version = "1.00";
[ObservableProperty]
private string _version = "1.00";
less boilerplate
leowest
leowest2w ago
it generates all the rest for u
Core Dream Studios
i got the old fashioned way stuck in my head XD isnt human memory fun? 😊
leowest
leowest2w ago
No description
leowest
leowest2w ago
this is a view
Core Dream Studios
but its a UC? confusing
leowest
leowest2w ago
yes it is confusing but you're using that one as a view
Core Dream Studios
i want it to be a uc so its in the mainview window
leowest
leowest2w ago
when you're create a UserControl for the purpose of it being just a control that is a different thing
sibber
sibber2w ago
user controls are views
leowest
leowest2w ago
it will be a child in the mainwindow for settings where u want its own vm
sibber
sibber2w ago
uis are called views
Core Dream Studios
see, i hate layout 😦
leowest
leowest2w ago
just think of it as Features
Core Dream Studios
i dunno if i want settings as a self contained uc or a window
leowest
leowest2w ago
forget View and ViewModel imagine this
Core Dream Studios
maybe im using UserControls for the wrong reasons as UC is to make CUSTOM control i get it now
leowest
leowest2w ago
root
- Features
• Settings
• Home
• Login
- LoginView
- LoginViewModel
- LoginModel
- Services
app.xaml
app.xaml.cs
root
- Features
• Settings
• Home
• Login
- LoginView
- LoginViewModel
- LoginModel
- Services
app.xaml
app.xaml.cs
Core Dream Studios
so i must use a window as a view 🙂
leowest
leowest2w ago
no
Core Dream Studios
nice tree
leowest
leowest2w ago
window is always the shell
leowest
leowest2w ago
its the top level where u can house views
Core Dream Studios
ok so MainView.xaml is fine
leowest
leowest2w ago
I usually name it Shell to make it less complciated but sure u can name it MainWindowView MainView it all makes sense
Core Dream Studios
some people make different ways of doing things
Core Dream Studios
example, this app, also WPF using popup windows so its confusing 😦
leowest
leowest2w ago
u can have Dialog Popup as a window that is no problem
Core Dream Studios
what would this be called
leowest
leowest2w ago
you would have a dialogservice that would summon that window etc
Core Dream Studios
i am horrible with design, its not something im good at
leowest
leowest2w ago
honestly that would be similar a toolwindow
Core Dream Studios
i can ironically make logos, illustrations etc but not ui
leowest
leowest2w ago
these are just window/view concepts but have u stopped to think u may not new a separted window? maybe your window is alredy big enough that simple having a navigation with in it is enough to house the settings page Honestly I think of the whole layout like this Shell/Window/Main as the casket all other UserControls are Views that are housed by it or summoned by it in some fashion
Core Dream Studios
ok so i got rid of the UserControls folder and made a Settings Window named SettingsView if i was rich id just hire someone to do the ui but im on ssi trying to make a life for myself and failing (perm physical disability) im very close too :X
leowest
leowest2w ago
so you're set that ur settingsview must be a window on its own then u will need to write a service that u will inject to your vm that needs to call it that will open/close/manage it
Core Dream Studios
well it dont need to be its own window it could be embedded
leowest
leowest2w ago
well u create it as Window
Core Dream Studios
hell, do it as a tab
leowest
leowest2w ago
so it can only be a window
Core Dream Studios
so what do I use? back to usercontrols?
leowest
leowest2w ago
if u want it to be housed inside a window it needs to be a UserControl
Core Dream Studios
ok got it
Core Dream Studios
ok there makes sense since embedded wont have its own modal buttons and title
leowest
leowest2w ago
yep now u make a vm for it and wire it all in the di and datatemplate and that's it
Core Dream Studios
all set
leowest
leowest2w ago
u dont need that u just need the datatemplate
MODiX
MODiX2w ago
leowest
<ContentControl Grid.Row="1" Content="{Binding Child}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:ChildViewModel}">
<local:ChildView />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:Child2ViewModel}">
<local:ChildView2 />
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
<ContentControl Grid.Row="1" Content="{Binding Child}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type vm:ChildViewModel}">
<local:ChildView />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:Child2ViewModel}">
<local:ChildView2 />
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
Quoted by
React with ❌ to remove this embed.
Core Dream Studios
this?
leowest
leowest2w ago
yes
Core Dream Studios
ok, sorry
leowest
leowest2w ago
and each view/vm would be 1 separate datatemplate of the views u want to be able to be swapped in there u can also connect the selection there to what was selected in a listbox if u want to make the menu react when u select something
Core Dream Studios
im close
leowest
leowest2w ago
No description
leowest
leowest2w ago
well your settingsview is not called childview
Core Dream Studios
yep fixed
leowest
leowest2w ago
did u do the binding on the vm for Child
Core Dream Studios
i dont even have nothing to bind yet, settingsview is emoty
leowest
leowest2w ago
u do
leowest
leowest2w ago
No description
leowest
leowest2w ago
u need to setup that if u want it to actually display
Core Dream Studios
so do i make dummy data pretty much in the vm?
leowest
leowest2w ago
mmm no
Core Dream Studios
using CommunityToolkit.Mvvm.ComponentModel; namespace TitanSTUDIO.ViewModels; public partial class SettingsViewModel : ObservableObject { [ObservableProperty] private string _dummy = "Dummy Data"; } oh 😐
leowest
leowest2w ago
👆 child sample there
Core Dream Studios
ok so what is this BaseViewModel i dont even see code for it im getting too tired and making dumbass mistakes tbh
leowest
leowest2w ago
ah its just the ObservableObject but instead I made a class that inherits from it as I tend to have things like Name and other properties that are common between
Core Dream Studios
ok changed it back to ObservableObject
leowest
leowest2w ago
public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
private string _name;
}
public partial class BaseViewModel : ObservableObject
{
[ObservableProperty]
private string _name;
}
Core Dream Studios
what is this going to be used for?
leowest
leowest2w ago
public partial class MainViewModel : BaseViewModel
{
public MainViewModel()
{
Name = "MainView";
}
}
public partial class MainViewModel : BaseViewModel
{
public MainViewModel()
{
Name = "MainView";
}
}
just an example its also a common class to be used if u need to have a List of VM or something
Core Dream Studios
but this is getting too confusing now
leowest
leowest2w ago
or an object that can be different vms
Core Dream Studios
so many addons :/
leowest
leowest2w ago
imagine this how would u be able to have SettingsViewModel, HomeViewModel, LoginViewModel inside Child is they have nothing in common
leowest
leowest2w ago
BaseViewModel acts as the interpreter for that
Core Dream Studios
thats true
Core Dream Studios
so its like the glue between them all
leowest
leowest2w ago
I will be back in 30 minutes or so food
Core Dream Studios
i need to sleep tbh, its past my bed time XD its why im messing up i cant focus
Core Dream Studios
but there, a basemodel
Core Dream Studios
and some error i guess but no problem, have a good one 🙂
leowest
leowest2w ago
now u need SettingsViewModel to inherit from it every vm would inherit from BaseViewModel
Core Dream Studios
that does make more sense
Core Dream Studios
😛
leowest
leowest2w ago
it should build/run now
Core Dream Studios
now it can access both baseviewmodel and the data in there ok sec
leowest
leowest2w ago
I dont see the last error
Core Dream Studios
getting somewhere what time is it by you?
leowest
leowest2w ago
u have not made the Child property to set it to the settings so its just inheriting CHild from the MainViewModel and printing it 11
Core Dream Studios
yeah ill fix it in a bit its 10pm for me sadly 11am?
leowest
leowest2w ago
pm
Core Dream Studios
ah you on tomorrow night at all? i cant function when my head is burnt out tbh never code when tired 🙂
leowest
leowest2w ago
¯\_(ツ)_/¯ im usually around
Core Dream Studios
<ContentControl Grid.Row="0" Content="{Binding }"> <ContentControl.Resources> <DataTemplate DataType="{x:Type vm:SettingsViewModel}"> <local:SettingsView /> </DataTemplate> </ContentControl.Resources> </ContentControl> i just need to figurew out what to bind to ok np i will def get back to this tomorrow, it's useless to do this if i can't focus done that so many times too, doesn't help XD I appreciate your help though @leowest , learning alot tbh.