Have you tried reading DesiredSize ? If it contains 0, try calling Measure , which runs in a Size structure containing large values ββfor Height and Width , then reading DesiredSize .
Please note that DesiredSize does not necessarily mean that the containing element will have it, but I suspect that it will provide you with the information you are after.
source share