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

Unable to facilitate x:Bind between scopes #2337

Closed
weitzhandler opened this issue Apr 5, 2020 — with docs.microsoft.com · 3 comments
Closed

Unable to facilitate x:Bind between scopes #2337

weitzhandler opened this issue Apr 5, 2020 — with docs.microsoft.com · 3 comments
Assignees
Labels

Comments

Copy link
Contributor

Hi,

I used to set the DataContext to lower scopes whenever necessary, so I can use shorter binding expressions: (ViewModel is of type ContactViewModel, that exposes a Phones collection property):

<Page DataContext="{Binding ViewModel}">
  <ListView ItemsSource="{Binding Phones}"/>
</Page>

I'm trying to use the above with x:Bind as follows:

<Page DataContext="{x:Bind ViewMode}">
  <ListView ItemsSource="{x:Bind Phones}"/>
</Page>

But I get the following error:
>XLS0432: The property 'Phones' was not found in type 'ContactsPage'. | MyProject.Client.UWP


Document Details

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

@MikeHillberg
Copy link
Contributor

x:Bind on a Page (or other x:class markup) binds to properties on the backing class, not to the DataContext like {Binding} does. So if this markup is for a class named ContactsPage, {x:Bind Phones} is looking for a ContactsPage.Phones property.

So your best solution might be the more verbose {x:Bind ViewModel.Phones}. You could also suggest this as a new feature by posting an issue to the repo.

@weitzhandler
Copy link
Contributor Author

@MikeHillberg

You could also suggest this as a new feature by posting an issue to the repo.

Done: microsoft/microsoft-ui-xaml#2237

@hkhmsft hkhmsft added the product-question general "how do I do X" questions label Apr 6, 2020
@hkhmsft
Copy link
Contributor

hkhmsft commented Apr 6, 2020

Thanks @MikeHillberg for the answer and @weitzhandler for filing the suggestion. If anything else arises, feel free to reopen the thread.

@hkhmsft hkhmsft closed this as completed Apr 6, 2020
QuinnRadich pushed a commit that referenced this issue Mar 30, 2022
* Author new Arm64EC ABI doc
QuinnRadich pushed a commit that referenced this issue Jun 3, 2022
* Remove references to Reveal Highlight style

Removing reference to Reveal Highlight from the Reveal Focus style page.
- Ref in parens near top.
- Referred to in Related articles links.
The Reveal Highlight page was removed.

* Update date

* Revert "Update date"

This reverts commit da0ca4d.

* Update date on reveal-focus

* Fix month on date in header

* Update PT Run docs

* fixes

* layout improvement

* fixes, update calculator table

* improve image

* fix spelling in clac warning

* fix spaces

* Update composition-effects.md and fix compile

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* fix hyperbolic calc operations

* Update installer link from WinUI3 tutorial

* Improve the downloads page (#2350)

* Update downloads.md

* Update downloads.md

* Update downloads.md

* Update downloads.md

* Update downloads.md

* Update downloads.md

* feedback

* remove VSIX and formatting

* Update downloads.md

* Update apply-rounded-corners.md

Wording changes and improved the P/Invoke signature to throw exceptions rather than return HRESULT.

* fixing typo (#2395)

* [BrokenLinksH2] Fixed the link path

Fixed the link filenames

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* [BrokenLinksH2] Fixed the link path

Fixed the link

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* resolve feedback

* update keyword list

* improvements

* fixes

* Info adjustments

* fix table

* Release appsdk 1.1 preview1 (#2332)

Publish docs to accompany Windows App SDK v1.1 preview 1

* Update release cadence table to 1.1.0-preview1 (#2408)

* Fix downloads link in 1.1 Preview 1 Rel Notes (#2409)

* Fix downloads link in 1.1 Preview 1 Rel Notes

* Once more

* Update preview-channel.md

Co-authored-by: Steven White <[email protected]>

* Add minimum .NET SDK version to 1.1-preview1 relnote (#2410)

* Update preview-channel.md

* Update preview-channel.md

* Update preview-channel.md

Co-authored-by: Steven White <[email protected]>

* new topic about config macros (#2411)

* polish (#2412)

* layout adjustments and requirements list update

* small fixes

* [BrokenLinksH2] Hid the broken link

Commented the broken link

* Add Arm64EC ABI doc (#2337)

* Author new Arm64EC ABI doc

* TOC (#2415)

* Fix link to arm abi (#2416)

* Fix broken download link (#2414)

* You can combine different WINRT_NATVIS settings (#2418)

* You can combine different WINRT_NATVIS settings

`WINRT_NATVIS` can also be set differently by different files. If any file enables `WINRT_NATVIS` (either explicitly or implicitly by defining `_DEBUG`), then the resulting module gets natvis support.

* Update macros.md

Co-authored-by: Steven White <[email protected]>

* Clarify when runtime is needed for push (#2419)

* Fix sub commands in "update" section

The "update all" section mistakenly left out that "update" is a sub-command of "source", as it does not work on its own as a top level winget command.

Additionally, these two update commands listed "C:\" at the beginning, which naturally only works if winget is located at the root of the C drive, which is not normally the case, nor do the other examples list this - thus, this has been removed.

* Additional 1.1-preview1 rel note comments (#2421)

* Additional 1.1-preview1 rel note comments

* Update preview-channel.md

Consistent "currently". Couple other minor tweaks.

* Resolving conflict

* Stwhi conflicts (#2422)

* TOC (#2415)

* Fix link to arm abi (#2416)

* Fix broken download link (#2414)

* You can combine different WINRT_NATVIS settings (#2418)

* You can combine different WINRT_NATVIS settings

`WINRT_NATVIS` can also be set differently by different files. If any file enables `WINRT_NATVIS` (either explicitly or implicitly by defining `_DEBUG`), then the resulting module gets natvis support.

* Update macros.md

Co-authored-by: Steven White <[email protected]>

* Clarify when runtime is needed for push (#2419)

Co-authored-by: Matt Wojciakowski <[email protected]>
Co-authored-by: angelazhangmsft <[email protected]>
Co-authored-by: Raymond Chen <[email protected]>

* Addressing comments

* Consistency with the other change to "evaluating".

* Notifications and self-contained deployment clarifications

Co-authored-by: Steven White <[email protected]>
Co-authored-by: Matt Wojciakowski <[email protected]>
Co-authored-by: angelazhangmsft <[email protected]>
Co-authored-by: Raymond Chen <[email protected]>

* Update what's new (#2424)

* Jken whatsnew mar22 (#2425)

* Update what's new

* Corrected broken links

* support nuance (#2426)

* Add 0.8.7 release notes (#2423)

* Add 0.8.7 release notes

* address feedback

* formatting

* Update stable-channel.md

Co-authored-by: Steven White <[email protected]>

* remove WinUI 3 margins

* latest available (#2428)

* fix broken link (#3764)

* naming convention (#2431)

* naming convention

* parens

* Updates to disadvantages. (#2432)

* Added instructions for hybrid CRT. (#2433)

* Added instructions for hybrid CRT.

* Update deploy-self-contained-apps.md

Co-authored-by: Steven White <[email protected]>

* Improved HybridCRT.props guidance. (#2434)

* Update Pivot recommendations

* fix link

* updating descriptions (#2437)

* typo

* Java path correction

As pointed out in issue #3721

* resolving conflicts

* Add note for winget upgrade (#2439)

* resolving build issues (#2440)

* resolving build issues

* fixing another issue

* fixing another issue 2

* fixing conflicts 2

Co-authored-by: Alvin Ashcraft <[email protected]>
Co-authored-by: htcfreek <[email protected]>
Co-authored-by: lindexi <[email protected]>
Co-authored-by: Sid Lama <[email protected]>
Co-authored-by: PRMerger16 <[email protected]>
Co-authored-by: PRMerger7 <[email protected]>
Co-authored-by: angelazhangmsft <[email protected]>
Co-authored-by: KB <[email protected]>
Co-authored-by: Peter Torr (MSFT) <[email protected]>
Co-authored-by: PRMerger8 <[email protected]>
Co-authored-by: PRMerger19 <[email protected]>
Co-authored-by: Linda Spiller <[email protected]>
Co-authored-by: Shannon Leavitt <[email protected]>
Co-authored-by: MB <[email protected]>
Co-authored-by: Gabby Bilka <[email protected]>
Co-authored-by: Matt Wojciakowski <[email protected]>
Co-authored-by: Raymond Chen <[email protected]>
Co-authored-by: Kade <[email protected]>
Co-authored-by: PRMerger3 <[email protected]>
Co-authored-by: John Kennedy <[email protected]>
Co-authored-by: Jim Walker (WINDOWS) <[email protected]>
Co-authored-by: PRMerger5 <[email protected]>
Co-authored-by: Mike Battista <[email protected]>
Co-authored-by: PRMerger9 <[email protected]>
QuinnRadich pushed a commit that referenced this issue Jun 3, 2022
* Remove references to Reveal Highlight style

Removing reference to Reveal Highlight from the Reveal Focus style page.
- Ref in parens near top.
- Referred to in Related articles links.
The Reveal Highlight page was removed.

* Update date

* Revert "Update date"

This reverts commit da0ca4d.

* Update date on reveal-focus

* Fix month on date in header

* Update PT Run docs

* fixes

* layout improvement

* fixes, update calculator table

* improve image

* fix spelling in clac warning

* fix spaces

* Update composition-effects.md and fix compile

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* fix hyperbolic calc operations

* Update installer link from WinUI3 tutorial

* Improve the downloads page (#2350)

* Update downloads.md

* Update downloads.md

* Update downloads.md

* Update downloads.md

* Update downloads.md

* Update downloads.md

* feedback

* remove VSIX and formatting

* Update downloads.md

* Update apply-rounded-corners.md

Wording changes and improved the P/Invoke signature to throw exceptions rather than return HRESULT.

* fixing typo (#2395)

* [BrokenLinksH2] Fixed the link path

Fixed the link filenames

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* [BrokenLinksH2] Fixed the link path

Fixed the link

* [BrokenLinksH2] Fixed the link path

Fixed the link path

* resolve feedback

* update keyword list

* improvements

* fixes

* Info adjustments

* fix table

* Release appsdk 1.1 preview1 (#2332)

Publish docs to accompany Windows App SDK v1.1 preview 1

* Update release cadence table to 1.1.0-preview1 (#2408)

* Fix downloads link in 1.1 Preview 1 Rel Notes (#2409)

* Fix downloads link in 1.1 Preview 1 Rel Notes

* Once more

* Update preview-channel.md

Co-authored-by: Steven White <[email protected]>

* Add minimum .NET SDK version to 1.1-preview1 relnote (#2410)

* Update preview-channel.md

* Update preview-channel.md

* Update preview-channel.md

Co-authored-by: Steven White <[email protected]>

* new topic about config macros (#2411)

* polish (#2412)

* layout adjustments and requirements list update

* small fixes

* [BrokenLinksH2] Hid the broken link

Commented the broken link

* Add Arm64EC ABI doc (#2337)

* Author new Arm64EC ABI doc

* TOC (#2415)

* Fix link to arm abi (#2416)

* Fix broken download link (#2414)

* You can combine different WINRT_NATVIS settings (#2418)

* You can combine different WINRT_NATVIS settings

`WINRT_NATVIS` can also be set differently by different files. If any file enables `WINRT_NATVIS` (either explicitly or implicitly by defining `_DEBUG`), then the resulting module gets natvis support.

* Update macros.md

Co-authored-by: Steven White <[email protected]>

* Clarify when runtime is needed for push (#2419)

* Fix sub commands in "update" section

The "update all" section mistakenly left out that "update" is a sub-command of "source", as it does not work on its own as a top level winget command.

Additionally, these two update commands listed "C:\" at the beginning, which naturally only works if winget is located at the root of the C drive, which is not normally the case, nor do the other examples list this - thus, this has been removed.

* Additional 1.1-preview1 rel note comments (#2421)

* Additional 1.1-preview1 rel note comments

* Update preview-channel.md

Consistent "currently". Couple other minor tweaks.

* Resolving conflict

* Stwhi conflicts (#2422)

* TOC (#2415)

* Fix link to arm abi (#2416)

* Fix broken download link (#2414)

* You can combine different WINRT_NATVIS settings (#2418)

* You can combine different WINRT_NATVIS settings

`WINRT_NATVIS` can also be set differently by different files. If any file enables `WINRT_NATVIS` (either explicitly or implicitly by defining `_DEBUG`), then the resulting module gets natvis support.

* Update macros.md

Co-authored-by: Steven White <[email protected]>

* Clarify when runtime is needed for push (#2419)

Co-authored-by: Matt Wojciakowski <[email protected]>
Co-authored-by: angelazhangmsft <[email protected]>
Co-authored-by: Raymond Chen <[email protected]>

* Addressing comments

* Consistency with the other change to "evaluating".

* Notifications and self-contained deployment clarifications

Co-authored-by: Steven White <[email protected]>
Co-authored-by: Matt Wojciakowski <[email protected]>
Co-authored-by: angelazhangmsft <[email protected]>
Co-authored-by: Raymond Chen <[email protected]>

* Update what's new (#2424)

* Jken whatsnew mar22 (#2425)

* Update what's new

* Corrected broken links

* support nuance (#2426)

* Add 0.8.7 release notes (#2423)

* Add 0.8.7 release notes

* address feedback

* formatting

* Update stable-channel.md

Co-authored-by: Steven White <[email protected]>

* remove WinUI 3 margins

* latest available (#2428)

* fix broken link (#3764)

* naming convention (#2431)

* naming convention

* parens

* Updates to disadvantages. (#2432)

* Added instructions for hybrid CRT. (#2433)

* Added instructions for hybrid CRT.

* Update deploy-self-contained-apps.md

Co-authored-by: Steven White <[email protected]>

* update page

* smal fixes

* Improved HybridCRT.props guidance. (#2434)

* Update Pivot recommendations

* fix link

* updating descriptions (#2437)

* typo

* Java path correction

As pointed out in issue #3721

* Add note for winget upgrade (#2439)

* resolving build issues (#2440)

* resolving build issues

* fixing another issue

* fixing another issue 2

* updating as per feedbafck (#2442)

* fix LayoutCycleException link

* Stwhi main/bootstrap cs 1 (#2444)

* C# APIs

* ready for review

* TOC

* formatting

* more corrections

* last corrections

* Update index.md

* Update docs for Windows App SDK 1.0.2  (#2441)

* Update 1.0.2 downloads

* Update downloads.md

* Add servicing-1.0.2 release notes and channel updates

* Update release-channels.md

* Update with CRT note

* Fix misdirected link

* Update hub/apps/windows-app-sdk/stable-channel.md

Co-authored-by: Gabby Bilka <[email protected]>
Co-authored-by: Steven White <[email protected]>
Co-authored-by: Gabby Bilka <[email protected]>
Co-authored-by: MatchaMatch <[email protected]>

* Added note about UseCrtSDKReferenceStaticWarning. (#2446)

* Link to sample parent directory rather than to the unpackaged sample. (#2447)

* Fix old link

* Adding a simple orientation page for toast notifications. Added desktop page back into TOC

* Forgot to add the overview page to the TOC

* Forgot to add the overview page to the TOC

* feedback and new shortcut

* small adjustment

* fix table

* fix tables

* spell fix

* Update Windows Runtime Component/Background Task migration (#2451)

* add links from UWP to Desktop WRCs

* update backgroundtask info

* add row for windows runtime components

* edits

* fix link

* fix support

* Edits

* edits

* Update feature-mapping-table.md

* Update creating-windows-runtime-components-in-csharp-and-visual-basic.md

* Update index.md

Co-authored-by: Steven White <[email protected]>

* Updates per PR review

* Fix spelling error

* Adding H1

* gitissue#3769-delete-image (#2461)

* fixing build issues

* fixing TBD (#2464)

Co-authored-by: Alvin Ashcraft <[email protected]>
Co-authored-by: htcfreek <[email protected]>
Co-authored-by: lindexi <[email protected]>
Co-authored-by: Sid Lama <[email protected]>
Co-authored-by: PRMerger16 <[email protected]>
Co-authored-by: PRMerger7 <[email protected]>
Co-authored-by: angelazhangmsft <[email protected]>
Co-authored-by: KB <[email protected]>
Co-authored-by: Peter Torr (MSFT) <[email protected]>
Co-authored-by: PRMerger8 <[email protected]>
Co-authored-by: PRMerger19 <[email protected]>
Co-authored-by: Linda Spiller <[email protected]>
Co-authored-by: Shannon Leavitt <[email protected]>
Co-authored-by: MB <[email protected]>
Co-authored-by: Gabby Bilka <[email protected]>
Co-authored-by: Matt Wojciakowski <[email protected]>
Co-authored-by: Raymond Chen <[email protected]>
Co-authored-by: Kade <[email protected]>
Co-authored-by: PRMerger3 <[email protected]>
Co-authored-by: John Kennedy <[email protected]>
Co-authored-by: Jim Walker (WINDOWS) <[email protected]>
Co-authored-by: PRMerger5 <[email protected]>
Co-authored-by: Mike Battista <[email protected]>
Co-authored-by: PRMerger9 <[email protected]>
Co-authored-by: PRMerger Service account 2 <[email protected]>
Co-authored-by: Ming Ho <[email protected]>
Co-authored-by: Gabby Bilka <[email protected]>
Co-authored-by: Vaheeshta Mehrshahi <[email protected]>
Co-authored-by: Drew Batchelor (he/him) <[email protected]>
Co-authored-by: Jeremy Danyow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants