1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// VisualStateManager FFI.
//
// A thin entrypoint over `VisualStateManager::GoToState` so Rust can drive
// control state transitions (the CommonStates / CheckStates / FocusStates
// groups a ControlTemplate declares) from code instead of only through triggers.
//
// The SDK signature is:
//
// static bool VisualStateManager::GoToState(
// FrameworkElement* control, Symbol stateName, bool useTransitions);
//
// The parameter is a `FrameworkElement*`, but GoToState only does useful work
// for a templated control: it walks the element's ControlTemplate looking for
// the VisualStateGroup that owns `stateName`. A plain element with no template
// (a bare Grid, a TextBlock) has no state groups to find, so the call returns
// false. So we don't gate on "is a Control" ourselves: an unknown state name
// and a non-templated element both fall out as `false`, which is the contract
// we want. (We expose GoToState rather than GoToElementState because control
// state transitions are the common case; GoToElementState is for app-defined
// groups on an arbitrary root and can be added separately if a need shows up.)
//
// No VerifyAccess(): this must never throw across the C ABI (mirrors the
// text_get/set and dependency_object_* accessors). Single-thread (View) affinity
// is the caller's responsibility.
extern "C" bool