-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemControl not binding #13421
Comments
Your XAML does not look valid. You for some reason have a nested window declaration? <Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AvaloniaNumberApp.ViewModels"
x:Class="AvaloniaNumberApp.Views.MainWindow"
Title="Avalonia Number App">
<Window>
<local:MainWindowViewModel/>
</Window> I assume this is actually meant to be <Design.DataContext>
<local:MainWindowViewModel/>
</Design.DataContext> https://docs.avaloniaui.net/docs/next/guides/implementation-guides/how-to-use-design-time-data |
Thanks for seeingthat. Having fixed that (openai.com is helping write this thing) I am still getting the binding error....this is reminding me of C++ hell where you can't see what it's trying to do. It's saying it can't find "" What it doesn't say is what exactly it is looking for. (e.g. Can't find Digits.set() or Digits.set(value) type error. |
You cannot blindly trust a chat bot, sorry to say. Also this is not an avalonian bug. So please open a Q&A instead of a bug report. Or join us on Telegram. Thx. |
Well the chatbot knows a lot more about it than I do and I'm trying to teach it too. And once I put in the xDataType I get this incorrect line# and position#
|
Please start here https://github.com/AvaloniaUI/Avalonia.Samples Your project seems to be a kinda broken atm. We cannot fix all of those issues for you. You need to learn the fundamentals of Avalonia and MVVM first. It's really better if you know what you or the bot is doing. Once you are used to it, you can make start hacking. |
FYI...If I add this it now compiles and displays correctly. Not desirable but I can't figure out how to get it compiled without it. |
Make sure to read docs about compiled bindings please. |
The chatbot as you are seeing is likely based on old examples, many of which probably wont work anymore. Avalonia has had a lot of subtle breaking changes since v11.0 was released. So while it may "know" more than you, what it knows probably does not work anymore, and I also would be surprised if it ends up getting mixed up with WPF and other XAML code. Also using an AI chatbot for this sort of things is also not a good idea. As you have also seen it can generate completely invalid code. Which you may not catch if you don't not know what you are doing. It's frankly a tool that is only useful if you know what it should be doing. As for the tutorials. I agree that some of them are very complicated and skip over some information, but can you please explain what exactly you problem you found so someone can fix it? They do work for learning how to use Avalonia. I personally used them myself when I started. Also in many cases you can just read WPF's documentation and examples. About ~60% of it applies to Avalonia due to how similar they are. |
This project (still in work)
https://www.dropbox.com/scl/fi/pj1xopwgujxzquqd2ce71/AvaloniaNumberApp.zip?rlkey=5aeqh6lxd4sj4mouxlndkm5qb&dl=0
Does not compile without setting this in MainWindow.axaml x:CompileBindings="false"
If you set this to "true" it gets an error which I can't figure out how to fix.
Mike
On Sunday, October 29, 2023 at 02:56:49 PM CDT, thevortexcloud ***@***.***> wrote:
Well the chatbot knows a lot more about it than I do and I'm trying to teach it too.
I've found the tutorials to be useless.
The chatbot as you are seeing is likely based on old examples, many of which probably wont work anymore. Avalonia has had a lot of subtle breaking changes since v11.0 was released. Using an AI chatbot for this sort of things is also not a good idea. As you have also seen it can generate completely invalid code. Which you did you may not catch if you don't not know what you are doing.
As for the tutorials. I agree that some of them are very complicated and skip over some information, but can you please explain what exactly you problem you found so someone can fix it?
Also in many cases you can just read WPF's documentation and examples. About ~60% of it applies to Avalonia due to how similar they are.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
That's exactly what I said, if you need compile binding, you need to set the x:DataType as in my screenshot, and add type casting in button binding. |
@mdblack98 I'll make a Q&A from this thread, as it is not an Avalonia bug. You are still welcome to ask if you need more help. For quick questions try also our chat https://t.me/Avalonia |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
ItemControl in XAML MVVM not binding -- could be my error but I can't see it.
To Reproduce
Using Avalonia 11.0.5 and Visual Studio' 2022 Preview 17.8.0 Preview 5.0 on Windows 11
Use this zip'd project file and build it. Also the XAML does not display.
https://www.dropbox.com/scl/fi/pj1xopwgujxzquqd2ce71/AvaloniaNumberApp.zip?rlkey=5aeqh6lxd4sj4mouxlndkm5qb&dl=0
Error I'm seeing is:
Severity Code Description Project File Line Suppression State Details
Error AVLN:0004 Unable to find a setter that allows multiple assignments to the property Content of type Avalonia.Controls:Avalonia.Controls.ContentControl Line 1, position 2. AvaloniaNumberApp C:\Users\mdbla\source\repos\AvaloniaNumberApp\Views\MainWindow.axaml 1
Expected behavior
Successful compile and visual display of XAML
Screenshots
Screenshots N/A
Additional context
N/A
AvaloniaNumberApp.zip
The text was updated successfully, but these errors were encountered: