Skip to content

UI Element Not Updating from AppService request #135

@SkyTheComputerGuy

Description

@SkyTheComputerGuy

Hello!

I’m experiencing an issue with a Xbox Game Bar widget where a Rectangle element’s Fill property is not visually updating as expected when receiving a request from a WPF app. I was wondering If I could get some assistance here.

Context: (Projects are not packaged)

  • WPF App: Send a request to the Game Bar widget via 'AppServiceConnection'
  • Game Bar Widget: Receives the request, updates the 'Fill' property of a Rectangle (x:Name="ColorRec"), and also confirms that the request has been processed. (I.e. there is a textbox in the WPF app that shows 'Result: {the current time it was processed}')

The Issue: (Code Snippets are below)

  • When the widget receives the request from the WPF app, the 'ColorRec' rectangle is supposed to change color from red to green, but it does not. (Rectangles initial Fill="Red")

  • The code in the 'AppServiceConnection_RequestReceived' method (defined in App.xaml.cs), specifically the SetInputAsync (defined in MainPage.xaml.cs) method is supposed to change the color

  • However:

    • After the first click the message box shows the Fill property as the color #FFFF0000 (red), after the color change the message box shows #FF008000 (green), but the actual color of the rectangle in the launched widget (from Win+G -> Widgets) does not change. Subsequent message boxes from the request path show that the color of the ColorRec.Fill is indeed #FF008000 (still green), yet the color of the rectangle stays red.

    • As a test I also have a button in the widget, when clicked it also shows a message box with the type of color of the rectangle, although no matter at what time it is pressed, the color always shows as Red (#FFFF0000). Meaning that even though the message boxes from the request body show Green, the click shows Red. If the color change directive in the button click handler is uncommented the color of the rectangle changes and it updates visibly in the widget.

This has led me to believe it has something to do with which thread calls what methods, or something of that sort? Any help would be really appreciated. Thank you.

Code Snippets:

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions