开发者

Inherit custom class from Panel and VirtualStackPanel

开发者 https://www.devze.com 2023-01-20 18:24 出处:网络
I am implementing a my custom class which needs to be derived from Panel. After inheriting from Panel, the overridden method \"MeasureOverride\" gets the default size.

I am implementing a my custom class which needs to be derived from Panel.

After inheriting from Panel, the overridden method "MeasureOverride" gets the default size.

In my xaml page, I am using ListBox for which no width and height is specified and this custom panel is called from ItemsPanel Template.

When the class is derived from Panel class, the width and height received in the param开发者_运维问答eter is infinity.

But, deriving the same class, from VirtualStackPanel, I get height and width ( the size in which parent control gets displayed).

Any idea, why this behavior? I need to derive the my control from Panel class but in that case needs the parent width & height size (calculated size based on the visible area available).

Regards Rajesh


Found the solution for same,

Implementing IScrollInfo interface solves the problem. By using IScrollInfo one can implement his/her own scroll containers.

0

精彩评论

暂无评论...
验证码 换一张
取 消