DevFear
Topic Author
Posts: 53
Joined: 29 Jun 2022, 12:36

OnVisualChildrenChanged not found

11 May 2023, 16:06

Good afternoon. In WPF, you can override the OnVisualChildrenChanged method to work with changing child elements inside the element. The method is not detected in Noesis. I work with my custom StackPanel. Source: https://learn.microsoft.com/en-us/dotne ... esktop-8.0
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: OnVisualChildrenChanged not found

12 May 2023, 11:28

As it happens with GetLayoutClip, this method is not yet exposed to C#, could you also add this to our bugtracker?
 
DevFear
Topic Author
Posts: 53
Joined: 29 Jun 2022, 12:36

Re: OnVisualChildrenChanged not found

12 May 2023, 11:35

Is there information about collections in various elements? Removed, added, etc. events?? In ItemsControl, I also didn't notice any tools for working with the collection.
 
DevFear
Topic Author
Posts: 53
Joined: 29 Jun 2022, 12:36

Re: OnVisualChildrenChanged not found

12 May 2023, 11:48

 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: OnVisualChildrenChanged not found

12 May 2023, 13:03

Thanks for the report.
Is there information about collections in various elements? Removed, added, etc. events?? In ItemsControl, I also didn't notice any tools for working with the collection.
The ObservableCollection has the CollectionChanged event, but ItemsControl.OnItemsChanged virtual method is not exposed to C# either. If you need it please report that too.
 
DevFear
Topic Author
Posts: 53
Joined: 29 Jun 2022, 12:36

Re: OnVisualChildrenChanged not found

14 May 2023, 14:20

That is, there are no ways to work with child elements inside the panel? As with ItemsControl, etc.?
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: OnVisualChildrenChanged not found

15 May 2023, 11:35

We didn't initially expose all the API to C# because when working with a MVVM pattern you don't usually need to deal with custom controls. Instead you work with ObservableCollections to interact with the collections of items in your data model.

Could you elaborate a bit more what are you trying to accomplish?
 
DevFear
Topic Author
Posts: 53
Joined: 29 Jun 2022, 12:36

Re: OnVisualChildrenChanged not found

15 May 2023, 11:45

Sometimes there are times when decisions need to be made quickly, without MVVM. For example, create your own layout mechanisms in Panel, etc. Otherwise, for simple examples, you would constantly have to create some kind of complex wrapper of business logic.

In this case, I wanted to modify the StackPanel and add something like Spacing to it. In WPF, I would just redefine OnVisualChildrenChanged and add space to the child elements. Then you would have your own custom panel that could be used both with and without MVVM.

But I think you can also do it through MeasureOverride and ArrangeOverride, which turned out in another example: viewtopic.php?t=2936 .

Who is online

Users browsing this forum: No registered users and 24 guests