Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ScrollViewer中显示用户控件_C#_User Controls_Microsoft Metro_Scrollviewer - Fatal编程技术网

C# 在ScrollViewer中显示用户控件

C# 在ScrollViewer中显示用户控件,c#,user-controls,microsoft-metro,scrollviewer,C#,User Controls,Microsoft Metro,Scrollviewer,我有一个滚动查看器,我想显示我的所有用户控件。我有两种类型的用户控件,即教育控件和工作控件。它们只是文本框和按钮。我动态地创建每个控件的各种编号,并将它们添加到usercontrol类型的列表中。但是,我无法显示所有的用户控件 滚动查看器xaml <ScrollViewer x:Name="myScrollViewer" HorizontalAlignment="Left" Height="518" Margin="128,10,0,0" Grid.Row="1" VerticalAlig

我有一个滚动查看器,我想显示我的所有用户控件。我有两种类型的用户控件,即教育控件和工作控件。它们只是文本框和按钮。我动态地创建每个控件的各种编号,并将它们添加到usercontrol类型的列表中。但是,我无法显示所有的用户控件

滚动查看器xaml

<ScrollViewer x:Name="myScrollViewer" HorizontalAlignment="Left" Height="518" Margin="128,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="1123" FontSize="22"/>

如何在scroll viewer中显示所有用户控件?

scroll viewer的内容必须是列表样式的控件,如列表框。ScrollViewer本身不知道如何呈现
列表
,因此它只打印类型名称


您可能希望
items
成为
ListBox
或类似控件的
ItemsSource

ScrollViewer的内容必须是列表样式的控件,例如ListBox。ScrollViewer本身不知道如何呈现
列表
,因此它只打印类型名称


您可能希望
items
成为
ListBox
或类似控件的
ItemsSource

我一发布这篇文章,就有预感是这样的。谢谢你的快速回复,这正是我所需要的。当我发布这篇文章时,我有一种预感,它就是这样的。谢谢你的快速回复,这是我需要的。
List<UserControl> info = new List<UserControl>();
EducationControl educationControl = new EducationControl(school._school, school._degree, school._fieldOfStudy, school._educationStartDate, school._educationEndDate);
info.Add(educationControl);
WorkControl workControl = new WorkControl(work._employer, work._jobTitle, work._jobStartDate, work._jobEndDate);
info.Add(workControl);
myScrollViewer.Content = info;
myScrollViewer.Content = info.ElementAt(0);