C
C#14mo 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
Thinker14mo ago
Doesn't appear that you have a main method? Also btw, don't commit bin and obj
Emelie
EmelieOP14mo ago
No description
Emelie
EmelieOP14mo ago
Doesn´t this work as the main in a WPF app? (I just started out, btw)
Thinker
Thinker14mo ago
That's just a constructor You need a Main method somewhere which launches the WPF app
Emelie
EmelieOP14mo ago
How would that look, like for example?
Emelie
EmelieOP14mo ago
Emelie
EmelieOP14mo ago
I also made this app, but this one works... still I can´t see a main method here as well?
Thinker
Thinker14mo ago
huh I don't know a lot about WPF, sorry
ClownFishUK
ClownFishUK14mo ago
I'll have a look but I'm very tired and not promising I can help okay.
Buddy
Buddy14mo ago
One thing, do not use the designer / Margin as the primary tool of doing layout. Use the layout controls $rulesofwpf
MODiX
MODiX14mo 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
Buddy14mo ago
Second thing, prefer using XAML instead of spawning controls from code-behind
ClownFishUK
ClownFishUK14mo ago
seems to have a leak cos my cpu memory was just shooting up perma
Buddy
Buddy14mo ago
Check line number 18 in MainWindow.xaml.cs 😛 do not give them the answer, let them find out for themselves
ClownFishUK
ClownFishUK14mo ago
mb xD
Accord
Accord14mo 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