Xaml 尝试绑定setter的值时出错
我有以下XAML:Xaml 尝试绑定setter的值时出错,xaml,windows-phone-8,binding,setter,Xaml,Windows Phone 8,Binding,Setter,我有以下XAML: <ListBox.ItemsPanel> <ItemsPanelTemplate> <Grid> <Grid.RowDefinitions> ...
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.RowDefinitions>
...
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
...
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
...
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Grid.Row" Value="{Binding Row, Mode=OneWay}" />
<Setter Property="Grid.Column" Value="{Binding Column, Mode=OneWay}" />
</Style>
</ListBox.ItemContainerStyle>
...
...
...
...
...
当页面加载时,我得到以下XamlParseException
:
未能分配到属性“System.Windows.Setter.Value”。[第69行位置:63]
内部异常:NotSupportedException:无法设置只读属性“” 错误中的行号对应于
Grid.Row
setter;如果我把一个硬编码的值而不是绑定,它工作得很好(但显然这不是我想要的)
发生什么事了?内部异常消息没有意义;我没有设置任何只读属性,当然也没有设置没有名称的属性
我是Windows Phone的新手,但我很确定相同的代码在WPF中也能正常工作。。。WP不支持setter中的绑定吗?您的怀疑似乎是正确的-根据,WP不支持setter值中的绑定
本文中还提供了一种变通方法,以及。老实说,我还没有玩过这些例子,但也许它们会对你有所帮助。谢谢!它就像一个符咒(一旦我知道如何使用它…)@ThomasLevesque,那么我很高兴我能帮上忙。祝你好运