Find XAML Binding Usages
find_binding_usagesList every XAML/AXAML {Binding} site for a view-model member before renaming or deleting it, including redirected bindings and what each resolves against.
Instructions
List the {Binding ...} sites in the solution's .xaml and .axaml markup that name a member path, with what each one resolves against. find_usages carries a markup edge for a root member bound against the DataContext; this tool lists every site, redirected bindings included. find_unresolved_bindings checks whether a bound member exists on its view-model.
Use it before renaming or deleting a view-model member.
With a path: sites (view, line, path, form), siteCount, byForm, deeperSegmentSites(+Count), pathlessBindingCount, scannedFileCount, sitesTruncated, note. form is dataContext (no redirect), elementName, relativeSource, source or xBind (WinUI {x:Bind}; in byForm only when non-zero). A path matches as the whole path or as its ROOT segment: 'Foo' finds {Binding Foo} and {Binding Foo.Bar}. The 'Bar' of {Binding Foo.Bar} (a member of Foo's type) is reported apart in deeperSegmentSites. On an elementName or relativeSource binding a leading 'DataContext.' is the hop to the element's view-model: {Binding DataContext.Cmd, RelativeSource=...} is a site of 'Cmd'.
Without a path: the inventory - members (member, siteCount, byForm), most-bound first, with distinctMemberCount and totalSiteCount. Lists cap at 200; counts are true totals. pathlessBindingCount counts every binding without a plain member root (an empty {Binding}, {Binding Mode=OneWay}, an attached path) over the whole solution, whatever scope and form say.
Markup is read from disk on every call: a markup edit needs no refresh_session. Only {Binding} ({CompiledBinding} too in .axaml) and {x:Bind} are read: a binding built in code-behind, element-syntax , {TemplateBinding} and a path assembled at runtime are invisible here - zero sites means 'verify before renaming or deleting', not proof.
Read-only; test projects are scanned too. path is a markup path, not resolved as a symbol; an unknown form matches nothing (the note says so).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>"
},
"name": "find_binding_usages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| form | No | Optional form filter: 'dataContext', 'elementName', 'relativeSource', 'source' or 'xBind'. Omit for all forms. Applies to both views. | |
| path | No | The exact (case-sensitive) bound member path, e.g. 'GestureLabel' or 'Foo.Bar'. Omit for the inventory view (every bound root member with its site counts). | |
| scope | No | 'solution' (default) or a view-path substring (e.g. 'AIContextBuilder.UI/Views/Dialogs') to narrow which markup files are reported. | solution |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. |