Linux Desktop Application - How to access visual tree programatically #16777
Replies: 4 comments 2 replies
-
Can you please share an example of what you tried or think should work? |
Beta Was this translation helpful? Give feedback.
-
In XAML, I have an ItemsControl which is bound to a collection of TextBlockObjects I have defined a TextBlockObject which has properties such as Height, Width, Name, Text, Foreground, Background. These TextBlockObjects are NOT derived from Microsoft.UI.Xaml.Controls.TextBlockControl In the method which constructs the MainViewModel, I create TextBlockObjects for each TextBlock I want to display and add them to the collection of TextBlockObjects This works. However, I later want to change the Foreground or Background color of the text block object from a Background task. In the previous version of Uno (1.75) and .Net 7, this worked. The foreground/background color changed With the latest version of Uno (1.89) and .Net 8., the Foreground/Background does not change. I have determined that Uno creates a shadow object of the type Microsoft.UI.Xaml.Controls.TextBlockControl for each of the TextBlock objects I add to the ItemsCollection. When I change the Foreground or Background and I am in the UnoEventLoop Thread, the Foreground/Background changes. When I change the Foreground/Background from a Background thread, the Properties change in the TextBlockObject but do not change in the shadow object I do not understand why this worked before and does not work now As a workaround, I created a Microsoft.UI,Xaml.Controls.TextBoxControl as a property each TextBlockObject. I rewrote the code such that the code now updates the appropriate property in the Microsoft.UI.Xaml.Controls.TextBlockControl. When I try to change the property from a background thread, I encounter a cannot access property from background thread error. I therefore changed the code to test if the thread had access to the object and, if not, used a Dispatcher to change the property from the UI thread. The problem is that I cannot position the TextBlockObject in the Canvas, In the previous version of Uno, whatever code created the shadow object also set Canvas,Left and Canvas,Top properties such that the TextBlock appeared in the correct space. How can I do this with Uno 1.89 and .Net 8? |
Beta Was this translation helpful? Give feedback.
-
Pardon my confusion I am developing on Ubuntu 20.04 |
Beta Was this translation helpful? Give feedback.
-
@HowardPWeiss I create a project named UnoSpySnoop. I think it may help you. See https://github.com/dotnet-campus/UnoSpySnoop And now I will update it to use the multi-window that host in the same process. |
Beta Was this translation helpful? Give feedback.
-
This is a very basic question
I would like to
Beta Was this translation helpful? Give feedback.
All reactions