C
C#9mo ago
Emelie

❔ WHY is my app not running?

https://github.com/EmelieH-cloud/WPF-timer This is driving me nuts. I have created a grid with a timer, and on run, the grid should be filled with generated buttons and the timer start. But when I try to run it, I get no window and no errors. Just completely blank. What am I doing wrong?
GitHub
GitHub - EmelieH-cloud/WPF-timer
Contribute to EmelieH-cloud/WPF-timer development by creating an account on GitHub.
16 Replies
Thinker
Thinker9mo ago
Doesn't appear that you have a main method? Also btw, don't commit bin and obj
Emelie
Emelie9mo ago
No description
Emelie
Emelie9mo ago
Doesn´t this work as the main in a WPF app? (I just started out, btw)
Thinker
Thinker9mo ago
That's just a constructor You need a Main method somewhere which launches the WPF app
Emelie
Emelie9mo ago
How would that look, like for example?
Emelie
Emelie9mo ago
Emelie
Emelie9mo ago
I also made this app, but this one works... still I can´t see a main method here as well?
Thinker
Thinker9mo ago
huh I don't know a lot about WPF, sorry
ClownFishUK
ClownFishUK9mo ago
I'll have a look but I'm very tired and not promising I can help okay.
Buddy
Buddy9mo ago
One thing, do not use the designer / Margin as the primary tool of doing layout. Use the layout controls $rulesofwpf
MODiX
MODiX9mo ago
Rules of WPF:

❌ Avoid the WPF Designer to eliminate a category of confusing bugs
❌ Don't rely on Margin as the primary tool for layouts
❌ Avoid writing UserControls or subclassing to extend a default control -- use Behaviors instead (Microsoft.Xaml.Behaviors.Wpf)

✅ Write XAML by hand and autoformat with "Ctrl K,D" or XAML Styler
✅ Rely upon XAML Hot Reload to design your app's UI at runtime
✅ Use layout controls (Grid, DockPanel, etc) to support proper resizing
✅ Use data binding to eliminate glue code and state synchronization issues
✅ Use collection controls and DataTemplate to dynamically create lists of controls
✅ Learn MVVM to create maintainable apps
✅ Use the Dispatcher to update controls from non-UI threads
✅ WPF's default controls can be easily modernized via $wpfuilibs
✅ Include relevant XAML, code-behind, and ViewModel code for questions when possible
Rules of WPF:

❌ Avoid the WPF Designer to eliminate a category of confusing bugs
❌ Don't rely on Margin as the primary tool for layouts
❌ Avoid writing UserControls or subclassing to extend a default control -- use Behaviors instead (Microsoft.Xaml.Behaviors.Wpf)

✅ Write XAML by hand and autoformat with "Ctrl K,D" or XAML Styler
✅ Rely upon XAML Hot Reload to design your app's UI at runtime
✅ Use layout controls (Grid, DockPanel, etc) to support proper resizing
✅ Use data binding to eliminate glue code and state synchronization issues
✅ Use collection controls and DataTemplate to dynamically create lists of controls
✅ Learn MVVM to create maintainable apps
✅ Use the Dispatcher to update controls from non-UI threads
✅ WPF's default controls can be easily modernized via $wpfuilibs
✅ Include relevant XAML, code-behind, and ViewModel code for questions when possible
Buddy
Buddy9mo ago
Second thing, prefer using XAML instead of spawning controls from code-behind
ClownFishUK
ClownFishUK9mo ago
seems to have a leak cos my cpu memory was just shooting up perma
Buddy
Buddy9mo ago
Check line number 18 in MainWindow.xaml.cs 😛 do not give them the answer, let them find out for themselves
ClownFishUK
ClownFishUK9mo ago
mb xD
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
✅ Help with authentication/authorization for my application with .net 7Hi, I was hoping someone could help me out with Claims/Identity/Roles. I have an application with ❔ WPF Binding to collection in static instance not updating listI have a collection in a static member of a class that's being changed. It should be firing `Proper✅ How to sum datetimeoffset and timespan?I have following structure: ```cs [JsonProperty( PropertyName = "timestamp" )] [JsonRequired] ✅ Code Hints Not Working??? Visual Studio 2022Has anyone else ran into this problem of the drop down box that shows what you can select code-wise ❔ DataGrid hyperlink cells without a Navigation WindowMy dialog isn't a Navigation Window. But it does have two `DataGrid` instances each of which has `D❔ Which library is best for mouse hooks in .net 6/7/8? MouseKeyHook/WindowsHook don't work.I tried them both in a console app and got this issue https://github.com/topstarai/WindowsHook/issue✅ Help LeetCode Problemusing System; using System.Collections.Generic; using System.Collections.Immutable; using System.Com❔ NSwag and API helpI'm learning how to build an APIs and connect to it from a Blazor front-end. I'm using NSwag to buil❔ Calling an Azure AD protected Web API endpoint from an Azure AD protected Web App [.NET 7]I am having trouble getting the correct flow/configuration to call my Web API Endpoint that is prote❔ Creating a github workflow to test solution (MSTest)I have this solution https://github.com/caedenph/wa-tor I have two projects within it, the base on