darthmaule2
Topic Author
Posts: 98
Joined: 23 Oct 2014, 19:54

Missing functions in needed for creating a custom panel in managed C# SDK

08 Jan 2019, 20:27

I see that MeasureOverride and ArrangeOverride were added in the latest BETA... Great!

But it appears I'm still missing a few functions. My class looks like this:
class VirtualizingTilePanel : Noesis.VirtualizingPanel, Noesis.IScrollInfo
I'm currently using these functions from WPF's VirtualizingPanel implementation that I can't find under Noesis:
protected void AddInternalChild(UIElement child)
protected void InsertInternalChild(Int32 index, UIElement child)
protected void RemoveInternalChildRange(Int32 index, Int32 range)
protected override void OnItemsChanged(object sender, ItemsChangedEventArgs e)
And this Panel property:
protected internal System.Windows.Controls.UIElementCollection InternalChildren { get; }
The only thing that I think I really need from that list is OnItemsChanged. I'm not sure if "InternalChildren" is the same as the existing Noesis Children property, if so, then I'm good there. The rest would be nice to have but probably not absolutely necessary.
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Missing functions in needed for creating a custom panel in managed C# SDK

09 Jan 2019, 12:27

Panel's InternalChildren property is just the same as Children, so you can use that.

All the Add/Insert/Remove Child methods are just redirected to the children collection, so you can use Children.Add/Insert/Remove instead.

And you can subscribe to the ItemsChanged event on the ItemContainerGenerator of the corresponding ItemsControl, something like this:
public class VirtualizingTilePanel : Noesis.VirtualizingPanel, Noesis.IScrollInfo
{
  public VirtualizingTilePanel()
  {
    Loaded += (s, e) =>
    {
      ItemsControl itemsControl = ItemsControl.GetItemsOwner(this);
      itemsControl?.Generator?.ItemsChanged += OnItemsChanged;
    }
  }
  private void OnItemsChanged(object sender, ItemsChangedEventArgs e)
  {
  }
}
Anyway these are functions that should be in the base classes in the future, so could you please report it in our bugtracker so we can keep track of this?
 
darthmaule2
Topic Author
Posts: 98
Joined: 23 Oct 2014, 19:54

Re: Missing functions in needed for creating a custom panel in managed C# SDK

09 Jan 2019, 15:30

Thanks for the work-arounds. Here's the bug:
https://www.noesisengine.com/bugs/view.php?id=1385
 
User avatar
jsantos
Site Admin
Posts: 3917
Joined: 20 Jan 2012, 17:18
Contact:

Re: Missing functions in needed for creating a custom panel in managed C# SDK

10 Jan 2019, 11:36

Thanks for the report!

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 14 guests