Override StackPanel ?
When inheriting from the standard StackPanel, my custom Stack works differently. In the WPF context, the StackPanel also automatically changes its height depending on the child elements. But in Noesis, my custom StackPanel does not adjust to the child elements.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Override StackPanel ?
The StackPanel will fit the height of its children when its VerticalAlignment is set to Center, Top or Bottom. If it is set to stretch, then it depends on the height of the parent container. This is because ArrangeOverride is implemented in StackPanel to return the available space in the parent container.
What is the structure of the xaml containing your StackPanel? How are you implementing ArrangeOverride? Could you paste here that info?
What is the structure of the xaml containing your StackPanel? How are you implementing ArrangeOverride? Could you paste here that info?
Re: Override StackPanel ?
Of course, here is an example of how my Layout StackPanel works calmly in the WPF editor.
Perhaps you need to implement something yourself?
Code:
Perhaps you need to implement something yourself?
Code:
Code: Select all
public class LayoutStackPanel : StackPanel
{
}
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Override StackPanel ?
I've tried to extend StackPanel and found that it was not creating the correct native proxy. This is a bug, could you please report it in our bugtracker?
It is creating a simple Panel, not a StackPanel, this is why you were seeing nothing inside the StackPanel.
Although we need to properly fix this I found a workaround you can easily apply by modifying Extend.cs in our plugin:
It is creating a simple Panel, not a StackPanel, this is why you were seeing nothing inside the StackPanel.
Although we need to properly fix this I found a workaround you can easily apply by modifying Extend.cs in our plugin:
Code: Select all
Index: Extend.cs
===================================================================
--- Extend.cs (revision 12519)
+++ Extend.cs (working copy)
@@ -1344,7 +1344,14 @@
else if (typeof(Noesis.IScrollInfo).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()) &&
typeof(Noesis.Panel).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
{
- nativeType = Noesis.ExtendScrollInfo.Extend(TypeFullName(type));
+ if (typeof(Noesis.StackPanel).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
+ {
+ nativeType = Noesis.StackPanel.Extend(TypeFullName(type));
+ }
+ else
+ {
+ nativeType = Noesis.ExtendScrollInfo.Extend(TypeFullName(type));
+ }
}
else if (type.GetTypeInfo().IsSubclassOf(typeof(Noesis.BaseComponent)))
{
Who is online
Users browsing this forum: No registered users and 93 guests