Adorner with visual child
Hi!
I'm trying to create an Adorner that renders a child element (e.g. a Border) instead of overriding OnRender method.
I have found WPF example here https://stackoverflow.com/questions/857 ... stackpanel which is also very similar to your EffectAdorner code, so I thought it will be simple enough, but I can't get it to work - the Border is not rendered.
Everything seems correct in the Inspector: the Border is a child of TestAdorner and has expected placement and size. It just isn't visible for some reason.
Am I doing something wrong here or is this usage unsupported?
I'm trying to create an Adorner that renders a child element (e.g. a Border) instead of overriding OnRender method.
I have found WPF example here https://stackoverflow.com/questions/857 ... stackpanel which is also very similar to your EffectAdorner code, so I thought it will be simple enough, but I can't get it to work - the Border is not rendered.
Everything seems correct in the Inspector: the Border is a child of TestAdorner and has expected placement and size. It just isn't visible for some reason.
Am I doing something wrong here or is this usage unsupported?
Code: Select all
TestAdorner::TestAdorner(UIElement* pAdornedElement) : Adorner(pAdornedElement)
{
Ptr<Border> pBorder = MakePtr<Border>();
pBorder->SetBackground(Brushes::Red());
m_pChild = pBorder;
AddVisualChild(m_pChild);
}
uint32_t TestAdorner::GetVisualChildrenCount() const
{
return 1;
}
Visual* TestAdorner::GetVisualChild(uint32_t index) const
{
return m_pChild;
}
Noesis::Size TestAdorner::MeasureOverride(const Noesis::Size&)
{
Noesis::UIElement* adornedElement = GetAdornedElement();
const Noesis::Size& adornedSize = adornedElement->GetRenderSize();
Noesis::Size finalSize = adornedSize;
m_pChild->Measure(finalSize);
return finalSize;
}
Noesis::Size TestAdorner::ArrangeOverride(const Noesis::Size&)
{
const Noesis::Size& finalSize = GetDesiredSize();
m_pChild->Arrange(Noesis::Rect(finalSize));
return finalSize;
}
-
sfernandez
Site Admin
- Posts: 3112
- Joined:
Re: Adorner with visual child
Hi,
It seems we have something wrong in our code and the child is not properly initialized. Could you please add a ticket in our bugtracker for this issue?
In the meantime, can you try to manually initialize it:
Please let me know if that fixes your issue.
It seems we have something wrong in our code and the child is not properly initialized. Could you please add a ticket in our bugtracker for this issue?
In the meantime, can you try to manually initialize it:
Code: Select all
Ptr<Border> pBorder = MakePtr<Border>();
pBorder->Init();
Re: Adorner with visual child
Thanks for the report!
Who is online
Users browsing this forum: Google [Bot] and 1 guest