[英]WP7: ListBox Style in DataTemplate throwing parser error
I have a Style which looks like this: 我有一个样式,看起来像这样:
<Style x:Name="SomeListBoxStyle" TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<DataTemplate>
<Grid Margin="5,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="75"/>
<ColumnDefinition Width="75"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Rest of template is commented out - error still occurs. -->
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
And a ListBox: 还有一个ListBox:
<ListBox x:Name="SomeListBox" Grid.Row="0" SelectionMode="Single" Style="{StaticResource SomeListBoxStyle}" Visibility="Collapsed" SelectionChanged="SomeListBox_SelectionChanged"/>
Upon running, I get the (very helpful) error: 运行后,我得到(非常有用)错误:
AG_E_UNKNOWN_ERROR [Line: 22 Position: 211]
AG_E_UNKNOWN_ERROR [线路:22位置:211]
This error points to the last attribute of the ListBox (no matter what the last attribute is). 此错误指向ListBox的最后一个属性(无论最后一个属性是什么)。 How am I applying this DataTemplate incorrectly?
我是如何错误地应用此DataTemplate的?
尝试将Property =“Template”更改为Property =“ItemTemplate”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.