Skip to content
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

Compiled bindings don't seem to work with MultiBindings #356

Closed
chsoft-rbi opened this issue Mar 16, 2022 · 2 comments · Fixed by #364
Closed

Compiled bindings don't seem to work with MultiBindings #356

chsoft-rbi opened this issue Mar 16, 2022 · 2 comments · Fixed by #364
Assignees
Labels
doc-bug Problem with the content; needs to be fixed [org] dotnet-maui/tech dotnet-mobile/prod Pri2

Comments

@chsoft-rbi
Copy link

If you add the following label to the StackLayout in the "Use compiled bindings" section

      <Label>
        <Label.Text>
          <MultiBinding StringFormat="{}Hue = {0:F2}, Saturation = {1:F2}, Luminosity = {2:F2}">
            <Binding Path="Hue"/>
            <Binding Path="Saturation"/>
            <Binding Path="Luminosity"/>
          </MultiBinding>
        </Label.Text>
      </Label>

and then change e.g. "Hue" to "Hue2" as binding path, the file still compiles.

On the other hand with the verbose writing method of a normal binding

      <Label>
        <Label.Text>
          <Binding StringFormat="{}Hue = {0:F2}" Path="Hue"/>
        </Label.Text>
      </Label>

changing the Path to "Hue2" causes a compiler error as expected.

I don't know if this is a compiler bug or whether this is information missing in the documentation similar to the note saying "Compiled bindings are disabled for any binding expressions that define the Source property. This is because the Source property is always set using the x:Reference markup extension, which can't be resolved at compile time"


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Mar 16, 2022
@davidbritch davidbritch self-assigned this Mar 16, 2022
@davidbritch davidbritch added the doc-bug Problem with the content; needs to be fixed [org] label Mar 16, 2022
@davidbritch
Copy link
Contributor

Hi @Naryorill

I've chatted to the engineers and as you've identified, compiled bindings don't work with multi-bindings. Therefore I'll update the doc with a note to that effect.

The engineers have an issue to add compiled bindings support to multi-bindings, but it's not something that will happen in the short term.

@Peter-Butler
Copy link

"*{0} ({1}) {2}" works " {0} ({1}) {2}" leading space makes a compile error "{0} ({1}) {2}" different compile errors with nothing between " and {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-bug Problem with the content; needs to be fixed [org] dotnet-maui/tech dotnet-mobile/prod Pri2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants