簡體   English   中英

WP7:DataTemplate中的ListBox樣式拋出解析器錯誤

[英]WP7: ListBox Style in DataTemplate throwing parser error

我有一個樣式,看起來像這樣:

<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>

還有一個ListBox:

<ListBox x:Name="SomeListBox" Grid.Row="0" SelectionMode="Single" Style="{StaticResource SomeListBoxStyle}" Visibility="Collapsed" SelectionChanged="SomeListBox_SelectionChanged"/>

運行后,我得到(非常有用)錯誤:

AG_E_UNKNOWN_ERROR [線路:22位置:211]

此錯誤指向ListBox的最后一個屬性(無論最后一個屬性是什么)。 我是如何錯誤地應用此DataTemplate的?

嘗試將Property =“Template”更改為Property =“ItemTemplate”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM