Comments (15)
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
- XamlC compiler null-refs when encountering a binding to an array access (#10396), similarity score: 0.71
- Resolving an x:Reference in a RELEASE build picks the wrong element in some cases. (#8149), similarity score: 0.71
- XamlC XC0022 error : Binding could be compiled if x:DataType is specified. (#20568), similarity score: 0.71
- [regression/8.0.0-preview.1.7762] [WinUI] CollectionView runtime binding errors when loading the ItemSource asynchronously (#16787), similarity score: 0.70
- The "XamlCTask" task failed unexpectedly. (#21910), similarity score: 0.70
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
from maui.
The same error if you use
SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}"
from maui.
Verified this issue with Visual Studio 17.10 Preview 7.0 + NET9.0 SDK (9.0.100-preview.3.24204.13).
MauiVersion = 9.0.0-preview.3.10457, repro this issue;
MauiVersion = 9.0.0-preview.2.10293, works well.
from maui.
Hi guys, I am facing these issues as well. Is there any workaround settings where we can bypass the error from XamlC
similar to
<XFDisableTargetsValidation>True</XFDisableTargetsValidation>
cos right now, I can't build and compile the project. kindly advise.
from maui.
maui/loc/pl/src/Controls/src/Build.Tasks/ErrorMessages.resx.lcl
Lines 69 to 77 in 39f90ee
There's been a few changes in SetPropertiesVisitor since Preview2, and I think this is the only place that throws that exception: https://github.com/dotnet/maui/blame/main/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs
@simonrozsival Would you have any ideas what it could be?
from maui.
@rogerbriggen @drasticactions previously, any binding with Source
wasn't compiled. After a recent change (#20610), we can now compile all bindings. Unfortunately, we can't infer the x:DataType form Source yet (#21834) and so in this case, the compiler doesn't know that it shouldn't be looking for the property SelectedItem
on MainPageViewModel
but instead on CollectionView
.
As a fix, you can set the x:DataType
on the binding that shouldn't inherit the parent's x:DataType
:
<CollectionView
x:Name="myCollection"
ItemsSource="{Binding Items}"
...
SelectionChangedCommandParameter="{Binding Source={x:Reference myCollection}, Path=SelectedItem, x:DataType=CollectionView}">
<CollectionView.ItemTemplate>
...
</CollectionView.ItemTemplate>
</CollectionView>
Does this solve your problem?
from maui.
one thing I found out is that when any parent element has assigned the x Attribute x:DataType with value, those child elements will be overriding with the parent value... basically, it is using the parent context to find the binding hence it throws the Property Binding not found.
from maui.
@rogerbriggen @drasticactions previously, any binding with
Source
wasn't compiled. After a recent change (#20610), we can now compile all bindings. Unfortunately, we can't infer the x:DataType form Source yet (#21834) and so in this case, the compiler doesn't know that it shouldn't be looking for the propertySelectedItem
onMainPageViewModel
but instead onCollectionView
.As a fix, you can set the
x:DataType
on the binding that shouldn't inherit the parent'sx:DataType
:<CollectionView x:Name="myCollection" ItemsSource="{Binding Items}" ... SelectionChangedCommandParameter="{Binding Source={x:Reference myCollection}, Path=SelectedItem, x:DataType=CollectionView}"> <CollectionView.ItemTemplate> ... </CollectionView.ItemTemplate> </CollectionView>
Does this solve your problem?
Many thanks for the response. Seem like I just need to remove the x:DataType for the time being.
from maui.
@simonrozsival Okay, that makes sense. Should this issue be closed then and duplicated under #21834?
from maui.
@drasticactions I'm not sure. I think this is mostly a documentation issue. We've made changes to how XamlC compiles bindings in .NET 9, but we haven't updated the docs yet. I think we need a new issue that will track the necessary changes to documentation and then we can close this issue.
from maui.
@rogerbriggen @drasticactions previously, any binding with
Source
wasn't compiled. After a recent change (#20610), we can now compile all bindings. Unfortunately, we can't infer the x:DataType form Source yet (#21834) and so in this case, the compiler doesn't know that it shouldn't be looking for the propertySelectedItem
onMainPageViewModel
but instead onCollectionView
.As a fix, you can set the
x:DataType
on the binding that shouldn't inherit the parent'sx:DataType
:<CollectionView x:Name="myCollection" ItemsSource="{Binding Items}" ... SelectionChangedCommandParameter="{Binding Source={x:Reference myCollection}, Path=SelectedItem, x:DataType=CollectionView}"> <CollectionView.ItemTemplate> ... </CollectionView.ItemTemplate> </CollectionView>
Does this solve your problem?
@cgp1976 Yes, this solves this issue. The only thing which is, that Visual Studio shows an error
The text means "the datatype property was not found in type BindingExtension.
Do I need to create a bug for that? Where?
from maui.
@rogerbriggen I think this is the same warning we saw in #21434. This seems to be a bug in the XAML editor in VS. I wonder where the best place to report it is (cc @StephaneDelcroix @PureWeen).
from maui.
@mgoertz-msft Would you know?
from maui.
Xamarin and MAUI never cease to surprise me on what they allow that other platforms like WPF and UWP/WinUI don't. I had no idea this was allowed to be used that way.
from maui.
I reported the issue in the VS Code extension here: microsoft/vscode-dotnettools#1131
from maui.
Related Issues (20)
- WebView hosting PDF still can't scroll when using the scrollbars on Catalyst HOT 2
- OnPlatform control of type x:Double is not accessible as font size HOT 2
- Has anyone done a human body keypoint test?
- Maui usage of Glide is preventing us from using our own model loaders HOT 2
- CollectionView SelectedItem loses Background after opening and closing a Modal page HOT 2
- CarouselView behaves strangely when manipulating position in ViewModel HOT 3
- [iOS] RecalculateSpanPositions causing crash HOT 1
- Haven't found the My Mac from the list of Debug target in curl braces HOT 3
- On Android, if there's more then one entry in ViewCell, the second entry calls the Unfocused event on every keystroke HOT 2
- the project needs to be deployed before we can debug. HOT 2
- [MAUI]Adding 7 to D10 and continue clicking a few more times, then click ‘-’, the page will get stuck. HOT 5
- Images do not layout correctly in Mac and iOS HOT 3
- Arabic Text Tap Gestures don't work on Label Spans in iOS HOT 2
- Run .NET Multi-platform App UI development problem run under Windows 10 HOT 3
- XAML error is shown when the content of a DataTemplate is not a View HOT 5
- Adding value dynamically using parameters to the InputTextarea in the OnBindingContextChanged after some delay, the value not updated properly. HOT 5
- (1)Error running default MAUI/NET8 win10 solution. (2)Another user has already installed an unpackaged version of this app (3) Could not establish trust relationship for the SSL/TLS secure channel HOT 4
- Spans with FontAttributes do not render on Android (When Span.Text uses data binding) HOT 2
- [Entry] [Android] Cursor makes undesired jumps with Masked Behavior HOT 3
- Error when running the project as windows machine HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maui.