If you want to scroll the items of the ItemsControl horizontally and vertically, you could add a ScrollViewer outside the ItemsControl.
When the height and width of the ScrollViewer is less than the height and width of the ItemsControl, you can scroll the ScrollViewer vertically and horizontally to view the complete items.
<ScrollViewer Grid.Row="1" Width="300" Height="300" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"
Grid.ColumnSpan="2">
<ItemsControl Name="ic" Background="Pink"
ItemsSource="{Binding TextBoxesCollection}" />
</ScrollViewer>
The code to create textbox:
public ICommand CreateNewTextBoxCommand
{
get => new HelperCommand((state) =>
{
TextBox tb = new TextBox();
tb.Width = 400;
Num = DateTime.Now.ToLongTimeString();
tb.Text = Num;
TextBoxesCollection.Add(tb);
RaisePropertyChanged(nameof(Num));
});
}
The picture of the result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our [documentation][5] to enable e-mail notifications if you want to receive the related email notification for this thread.
[5]: https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html