C
C#4mo ago
Cynical

Image Opacity Mask loading in UserControl but not on Page

I ensured that they're in the same local and I even tried putting them all in the same folder but nothing helped
No description
No description
No description
7 Replies
Buddy
Buddy4mo ago
Please right-click the image in solution explorer make sure build action is set to Resource
Cynical
CynicalOP4mo ago
It is, and it's set to copy if newer, but I also tried copy always and none
Buddy
Buddy4mo ago
Did you build the app? remember this $rulesofwpf
MODiX
MODiX4mo 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
Buddy4mo ago
❌ Avoid the WPF Designer to eliminate a category of confusing bugs
Cynical
CynicalOP4mo ago
Yes and it always crashes when it's trying to initialize the image The error is the same as in the editor I got around it by introducing it as a resourcedictionary element on top of the page
Buddy
Buddy4mo ago
Try to load it like this
ImageSource="pack://yourNamespace:,,,/UC/ImageAssets/OPMask.png"
ImageSource="pack://yourNamespace:,,,/UC/ImageAssets/OPMask.png"
Want results from more Discord servers?
Add your server