ScrollBars are not visible after changing positions of controls inside a Canvas
- by akjoshi
Hi,
I created a custom canvas control inheriting from WPF Canvas. I am using it like this in main window -
<ScrollViewer
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<RTD:RTDesignerCanvas
Margin="5"
Background="White"
x:Name="canvas1"
Focusable="True"
AllowDrop="True">
</RTD:RTDesignerCanvas>
</ScrollViewer>
Everyhting works fine but when I try to set the position of controls inside it like this
Canvas.SetTop(item, 200);
scrollbars are not visible and control is hiddedn down somewhere. Intrestingly, if I add another control to it scroll bars are visible and I can scroll downwards to see the previous control.
I tried to use
base.InvalidateVisual();
base.UpdateLayout();
base.InvalidateArrange();
after changing items Top or Left but nothing happens; Am I missing something or this happens due to some bug?