✅ Need help making classes
My current classes don't work, compilation error CS0115 for no reason, i'm crying here.
24 Replies
oh and code CS0263
Most people dont memorize the error codes, and even if we look them up they dont contain type names and other details that might be valuable. Can you screenshot or copy the error log?
Are you using WPF?
yes
My log is in czech but it says:
partial class GameMainMenu can't define different basic classes
couldn't find fittable method to override [ open(); close() ]
The namespace copys the file structure
Making EnginePage an interface doesn't work...
idk what else to do.
Show error.
.
I feel like i might be doing this all wrong or idk
I mean the compilation error
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/xaml/?view=netdesktop-8.0#events-and-xaml-code-behind
You are using a different base class from the c# class that WPF generates for your xaml definition
XAML overview - WPF .NET
Learn how the XAML language is structured and implemented by Windows Presentation Foundation (WPF) for .NET.
Since WPF generates a partial
MainMenuPage
you get the conflicting partial declarations with different base classes
Subsequently the compiler is confused and does not recognize your override methods anymore, since it's trying to resolve them via the base class defined in the WPF-generated partial MainMenuPage
Stack Overflow
How do you specify a different base class in .xaml files (Silverlig...
How can you specify a common base class in .xaml files for seperate Silverlight Page classes? I have a few common properties that I would like to share across pages, but I don't know how to do this
This might help you define the base class in XAML and avoid the partial class conflicts
To explain what i'm tryna do - I have a window in which i'll have a game. In this window theres a <Frame/> and i want my own Page class, lets say EnginePage, that inherits from Page cuz it's it's extention. From EnginePage all the other pages inherit. There won't be a EnginePage object, so it's abstract. I want to control the change of pages more "strongly", so a static SwitchPage<T>() function is implemented. I want to allow the pages to have functions that activate when opened and closed, so public abstract void Open() and Close()
oh my god
Can you share the xaml of your MainMenuPage?
I've tried so many things from now, i believe... yup, i deleted the files to start fresh cuz the code is already scatered acros multiple discord convos and ChatGPT chats...
here, top message
but i'll propably just do a custom XML element with UserControl
I meant the actual GameMainMenu.xaml file
oh...
i mean i didn't change anything... except namespaces and class name when renaming stuff but i checked multiple times that it was correct.
If you share your xaml code I can help you figure out how to change it to define the base class used in the WPF-generated c# code
ok
ERROR: Name EnginePage doesn't exist in clr-namespace:BeatBooth.pages - XDG0008
EnginePage doesn't have xml, i assumed from the StackOverflow that it didn't need one.I'm assuming the xaml code is from the
GameMainMenu.xaml
file?
If so, change
xmlns:local="clr-namespace:BeatBooth.pages"
xmlns:local="clr-namespace:BeatBooth.Classes.Pages"
Otherwise, it's attempting to localize your EnginePage
class in the BeatBooth.pages
namespace where of course it doesn't exist.I figured it all out
Thx for the help
$close
If you have no further questions, please use /close to mark the forum thread as answered