question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] x:Bind should support general string indexers without interface in C#

See original GitHub issue

Describe the bug The documentation for x:Bind here in the ‘path to the function’ section specifies:

The path to the function is specified like other property paths and can include dots (.), indexers or casts to locate the function.

However, it appears that non-integer based indexers, e.g. strings, are not supported?

I was trying to bind directly to a Graph function with the Windows Community Toolkit’s GraphPresenter:

RequestBuilder="{x:Bind providers:ProviderManager.Instance.GlobalProvider.Graph.Teams['<guid here>'].Channels['<guid thing here>'].Messages, Mode=OneWay}"

As these classes use string indexers to build the query to the Graph, E.g.

ITeamRequestBuilder this[string id] { get; }

However VS tells me in the x:Bind expression that I have provided an “invalid index value” and “WMC1110: Invalid binding path … Unexpected array indexer”.

Expected behavior I would have expected string indexers to work just as I can pass them into function parameters with x:Bind in single-quotes.

Version Info NuGet package version: WUX

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JeanRocacommented, Mar 10, 2021

Alright I see thank you for the insight. I will go ahead and place it in the backlog, but can’t quite guarantee an ETA for it yet. I will leave the issue open.

1reaction
StephenLPeterscommented, Aug 6, 2020

@StephenLPeters I understand that this was not intended as designed originally, but this is still a feature request.

Is there a reason the collection needs to be mutable to support this feature? Can we get a few more details here? I know it’ll still need WinUI 3 to be fixed most likely in the future, if possible.

Thanks!

Sorry the triage team interpretated the conversation differently. We can reuse this as a feature proposal

Read more comments on GitHub >

github_iconTop Results From Across the Web

{x:Bind} markup extension - UWP applications
The xBind markup extension is a high performance alternative to Binding. xBind - new for Windows 10 - runs in less time and...
Read more >
Data binding in depth - UWP applications
Binding to string indexers gives you the effect of binding to dynamic properties without having to implement ICustomPropertyProvider. For other ...
Read more >
VxWorks Application Programmer's Guide, 6.2
The companion volume to this book, the VxWorks Kernel Programmer's Guide, provides material specific to kernel features and kernel-based ...
Read more >
Indexer named "Item" required by interface but not possible ...
String, while Item takes a System.Object parameter and returns a System.Object. Item is referred to as an indexed property, meaning that it ...
Read more >
How do I pass the current list item to an x:Bind function?
This works fine if I need to pass a property of the item to the function, or even multiple properties, such as <TextBlock...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found