Santhiya
Santhiya

Reputation: 301

InkCanvas not working in UWP

I am using InkCanvas, but the InkCanvas not working in inner panel and my code is

<Grid x:Name="mainGrid">

    <StackPanel>

        <InkCanvas x:Name="inkCanvas" />

    </StackPanel>

</Grid>

The above code working well in WPF, the problem in UWP.

Please suggest me, how to solve this.

Upvotes: 0

Views: 213

Answers (1)

Jayden
Jayden

Reputation: 3286

StackPanel is a layout panel that arranges child elements into a single line that can be oriented horizontally or vertically. By default, StackPanel stacks items vertically from top to bottom in the order they are declared.

For more info, see Remark of StackPanel.

By default, the Orientation of StackPanel is Vertical that the ActualHeight of InkCanvas is 0. If you set the Orientation of StackPanel to Horizontal that the ActualWidth of InkCanvas is 0.

We can't set VerticalAlignment to Stretch for a child of a StackPanel with Vertical of Orientation that the ActualHeight is 0.

If you want to fill exactly the width and height of the window to the InkCanvas, we should be able to replace the StackPanel by a Grid.

If you want to use the StackPanel and want to show the InkCanvas, you should be able to set Width and Height of the InkCanvas.

Upvotes: 1

Related Questions