I am trying to create content inside of a Scrollbar in a Dialog. I am doing this through C# instead of XAML even though this is Win UI 3. The problem I am experiencing is that my Scrollbar is not on the right side of the dialog instead it is covering content.

This is the my current code that makes the scrollbar:
StackPanel contentPanel = new StackPanel()
{
Orientation = Orientation.Vertical,
Children =
{
new TextBlock
{
Text = "Choose a color then select Save.",
Margin = new Thickness(0, 0, 0, 10)
},
new ColorPicker
{
ColorSpectrumShape = ColorSpectrumShape.Ring,
// Other settings...
}
}
};
ScrollViewer scrollViewer = new ScrollViewer
{
Content = contentPanel,
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
VerticalAlignment = VerticalAlignment.Stretch,
HorizontalAlignment = HorizontalAlignment.Right,
};
ContentDialog dialog = new()
{
Title = "Choose a color",
Content = scrollViewer,
PrimaryButtonText = "Save",
CloseButtonText = "Discard",
DefaultButton = ContentDialogButton.Primary,
XamlRoot = this.Content.XamlRoot,
};

Notice how the Scrollbar is touching the side. This what I am trying to do.
I had searched online for help but I did not find help to this issue.
I tried different ways of aligning the Scrollbar but none of those ways worked.
I had expected VerticalAlignment = VerticalAlignment.Stretch to align the Scrollbar the the right side of the dialog. This did not work.