❔ Problem Binding to Image Size
I am making an app that displays a series of books. An image and title of the book is to be displayed in a listBox of the main window. So far this works well. I decided to add a slider to allow the user to choose a size for the image of the book. I bind the width and height of the image to the ViewModel and make a switch statement for the various locations of the slider to determine the size of the image.
When I start the app I run into two problems:
1. The image of each book takes up the entire width of the window OR
2. I get a System.InvalidOperationException: 'Invalid size returned for Measure.'
I believe the problem is connected to the "OnSliderChanged" method of my ViewModel. Initially, the slider is set to 0 (but my slider is between 1 and 5) and so it was throwing an exception. I end the method early if it is set to 0 and the exception thrown above is shown.
J
JakenVeina•384d ago
what is the container for this
Image
tag?
the Width and Height settings are worthless if the container doesn't respect themN
Neeblue•384d ago
It's an Avalonia Image. I can set the size no problem if I manually enter the size, but when I try to bind them it all goes weird.
J
JakenVeina•383d ago
okay, but what's it's container?
also, why are you using
Slider
for the switch, instead of value
?A
Accord•375d 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.We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
51KMembers
View on DiscordWant results from more Discord servers?
More Posts❔ whats the best site or youtube channel to start learning c#?just downloaded visual studio and wanted to know what would be the best way to learn C#❔ C# MVC - Erroring in VSC not VS2022I'm writing a C# .Net Core 7.0 web application with dapper for my SQL queries.
It runs just fine inString Contain issueSo im trying to get a word in a string using Contain but its not getting the word, I havent found a ❔ Catching Exceptions with generic parameters?When adding an entity to the database, i first check if it already exists and if it does I throw an ❔ How should I learn programming?I'm sure this is a common question, but I want to learn game development but am a pretty new C# prog❔ How to properly structure projects in a multi-app MVVM solution?I tend to structure my MVVM projects in the following way:
```
.
├── src/
│ ├── Applications/
│ Sending File and Data to a Minimal API endpointHi. I am using .NET 7, Minimal API and Mailkit.
What I want to do is to send an attachment along wi❔ reprotucing the kings pathcan anybody help me fix this code
https://paste.mod.gg/sgsvrbaqnmpi/0
```
the input is
number of obs❔ Its there a way to fix this?Hi there, currently I am trying to develop some functions to publish them to azure later, but right ✅ Does this styling code look right?I'm using this code for a simple hover effect. Im wondering if I'm doing this correctly:
<Window.Re❔ ?[] operator for dictionariesIs not working. It is explained here. https://learn.microsoft.com/en-us/dotnet/csharp/language-refer❔ IAsyncEnumerable vs List<T> as parameter in methodI have a method that is overloaded and will take in a List<T> or IAsyncEnumerable. The method will b❔ This code is bugged how can i solve it?```LogiwaEntities1 db = new LogiwaEntities1();
ProductData productData = new ProductData✅ How to add hover effect to WPF button elementThis code I'm using isn't working. When I hover over buttons its a lightblue color.
<Style