Skip to content

FeedView: support binding Source to a plain (non-Feed/State) value #3144

Description

@kazo0

Problem

To make previews (and Hot Design previews) useful for MVUX-based pages, we need a way to show a page in a realistic state without instantiating the real model. Mocking the model is expensive: models are injected with services (there is no DI in previews), so you end up needing factories, partial classes, and mocks for the whole business layer just to render a page.

A much less intrusive path is to let the design-time/preview XAML bind FeedView.Source directly to the plain mock data we already generate, instead of to an IFeed<T> / IState<T>.

Proposal

FeedView.Source should accept a constant (non-reactive) value and surface it through to the data templates as the Data of a successful message.

Today, when Source changes, FeedView casts the incoming object to a signal/message (IFeed<T>) and does nothing useful if that cast fails. The suggested change is to make that path conditional: if the value is not already a signal, wrap it in a Feed.Async-style constant feed and continue as normal.

Scope of this issue (PoC)

  1. Verify the current behavior — bind FeedView.Source to a plain object and to a plain collection and record what actually happens. There is a suspicion that a plain collection may already pass straight through; confirm or refute it before writing any code.
  2. If it does not work, prototype the conditional wrap at the Source-changed hook (non-signal value -> constant feed) and confirm the data templates render.
  3. Report back on what the change touches and whether it can be made without breaking existing IFeed/IState sources.

Worth syncing with @dr1rrb on the intended behavior before changing anything — this may be intentional today.

Out of scope

Commands exposed on FeedView (e.g. refresh) are not expected to work against a constant source. Only Data matters for the preview scenario. Error/exception surfacing can be looked at separately.

Notes

Pairs with #3145 (descendant state-binding markup extension) — together they remove the need to mock MVUX models for previews.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions