xaml – 属性内容设置多次
发布时间:2020-09-25 20:26:50 所属栏目:Windows 来源:互联网
导读:我的代码如下所示,我收到以下错误。 错误: “物业”内容“不止一次” 码: controls:PanoramaItem Header=headlines TextBlock Text={Binding Tones} / !--Double line list with image placeholder and text wrappin
我的代码如下所示,我收到以下错误。 错误: 码: <controls:PanoramaItem Header="headlines"> <TextBlock Text="{Binding Tones}" /> <!--Double line list with image placeholder and text wrapping--> <ListBox Margin="0,-12,0" ItemsSource="{Binding Tones}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,17"> <!--Replace rectangle with image--> <Image Source="{Binding ImageUrl}" Height="75" Width="100" Margin="12,10,9,0" VerticalAlignment="Top"/> <!--<Rectangle Height="100" Width="100" Fill="#FFE5001b" Margin="12,0"/>--> <StackPanel Width="311"> <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}"/> <!--<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>--> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </controls:PanoramaItem>一个PanoramaItem只能有一个子控件,但是你目前有一个TextBlock和一个ListBox。要解决这个问题,只需添加另一个父控件来保存TextBlock和ListBox(如StackPanel或Grid)。例如: <controls:PanoramaItem Header="headlines"> <grid> <TextBlock Text="{Binding Tones}" /> <!--Double line list with image placeholder and text wrapping--> <ListBox Margin="0,0" ItemsSource="{Binding Tones}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,17"> <!--Replace rectangle with image--> <Image Source="{Binding ImageUrl}" Height="75" Width="100" Margin="12,0" VerticalAlignment="Top"/> <!--<Rectangle Height="100" Width="100" Fill="#FFE5001b" Margin="12,0"/>--> <StackPanel Width="311"> <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}"/> <!--<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>--> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </grid> </controls:PanoramaItem> (编辑:岳阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 02、Windows Server 2003域账户管理(02)
- 使用def文件简化dll导出
- 在Windows XP上从压缩标准库中嵌入Python 3.3
- 如何将列表转换为ObservableCollection?
- 如何将windows-1250 / Cp1250中编码的String转换为utf-8?
- Windows域用户设置用户登录脚本
- windows – 用户和内核之间的线程fs段寄存器切换
- Windows – 如何将多个文件名传递给上下文菜单Shell命令?
- Windows下IIS6/Apache2.2.4+MySQL5.2+PHP5.2.1安装配置方法
- Windows Phone 8和Android可以通过Wifi Direct连接吗?