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?
Update:
to clarify say I have a canvas having its width, height as 100, 100. Now if I move a control(already added in canvas) using Canvas.SetLeft(myControl, 200) then it will move to a position which is not visible by default and scroll bars are also disabled, so there is no way to see that control. Now if I add another control to Canvas scroll bars appear correctly and I can see the previous control by scrolling.