AG_E_PARSER_BAD_PROPERTY_VALUE (строка 7; позиция 51) - PullRequest
0 голосов
/ 01 февраля 2012

Это мой XAML-код в моем проекте, в этом первом я отображаю MainListBox, затем отображаю ChatListBox в зависимости от выбора пользователя.Когда пользователь выбирает чат, я получаю исключение синтаксического анализа Xaml во время выполнения.

это весь мой код Xaml ...

<phone:PhoneApplicationPage 
x:Class="DocomoMessenger.View.Buddies"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True" Loaded="PhoneApplicationPage_Loaded">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="126"/>
        <RowDefinition Height="580*"/>
        <RowDefinition Height="75"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="2,2,0,2">
        <ProgressBar Height="3" Name="waitprogess" Margin="0,2,0,0" />
        <TextBlock x:Name="txtload" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,5,12,0" />
        <TextBlock x:Name="PageTitle" Text="page name" Margin="1,0,0,0" Style="{StaticResource PhoneTextTitle1Style}" HorizontalAlignment="Center" />
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="2,0,2,0">
        <Border BorderThickness="5" BorderBrush="DarkGray" CornerRadius="10" Name="buddyborder">
                <ListBox x:Name="MainListBox" >
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Height="100" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="50"/>
                                </Grid.ColumnDefinitions>
                                <Image Grid.Column="0" Source="{Binding IM}" Stretch="Fill" Width="50" Height="50" VerticalAlignment="Center" HorizontalAlignment="Center" ></Image>
                                <StackPanel Margin="1,4,0,0" Grid.Column="1" x:Name="details" Height="100">
                                    <TextBlock Text="{Binding Name}" Style="{StaticResource PhoneTextNormalStyle}" Foreground="Brown" Padding="10"/>
                                    <TextBlock Text="{Binding StatusMsg}" FontSize="{StaticResource PhoneFontSizeSmall}" TextWrapping="Wrap" Padding="10" />
                                </StackPanel>
                                <Image Tag="{Binding Name}" Source="{Binding IMChat}" Grid.Column="2" Stretch="Uniform" Width="40" Height="40" VerticalAlignment="Center" HorizontalAlignment="Center" Name="imgchat"  MouseLeftButtonUp="imgchat_MouseLeftButtonUp"></Image>
                                <Line Stretch="UniformToFill" Grid.ColumnSpan="3" Stroke="DarkGray" StrokeThickness="2" Margin="0,10,0,0" X1="10" Y1="10" Y2="10" VerticalAlignment="Bottom" />
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
        </Border>

        <ListBox x:Name="ChatListBox" Margin="2,2,0,0" Opacity="1" Visibility="Collapsed" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Name="megrid" Margin="3,5,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40*"/>
                            <RowDefinition Height="40"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="{Binding FirstCol}"/>
                            <ColumnDefinition Width="20"/>
                            <ColumnDefinition Width="{Binding LastCol}"/>
                        </Grid.ColumnDefinitions>

                        <Image Name="imgbud" Source="{Binding IM}" Grid.Column="{Binding ImgCol}" Grid.Row="1" Stretch="Uniform" Width="50" Height="50"/>
                        <Rectangle Grid.RowSpan="2" RadiusY="20" RadiusX="20" Grid.Column="{Binding RectCol}" Fill="{Binding Bru}" />
                        <TextBlock Text="{Binding Name}" Grid.Row="0" TextWrapping="Wrap" Grid.Column="{Binding RectCol}" Padding="10" />
                        <TextBlock Text="{Binding Time}" Grid.Row="1" Grid.Column="{Binding RectCol}" Padding="10" />
                        <Path Data="{Binding Obj}" Fill="{Binding Bru}" Margin="0,0,-5,0" HorizontalAlignment="{Binding HorAlig}" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

    </Grid>

    <Grid x:Name="sendmsg" Height="75" VerticalAlignment="Bottom" Grid.Row="2" Visibility="Collapsed">
        <TextBox Name="txtmsg" Text="type" Padding="5" Opacity="0.8" MouseLeftButtonUp="txtmsg_MouseLeftButtonUp" Width="370" HorizontalAlignment="Left" />
        <Image Name="imgsend" Width="100" Height="46" Source="/DocomoMessenger;component/Themes/send.png" HorizontalAlignment="Right" Stretch="UniformToFill" Margin="0,12,4,17" MouseLeftButtonUp="imgsend_MouseLeftButtonUp"/>
    </Grid>
</Grid>

<!--Sample code showing usage of ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
        <shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
            <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
        </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>-->

, когда я запускаю этот код, яполучил следующую ошибку XamlParsinException.enter image description here

enter image description here

Кто-нибудь, помогите мне.Спасибо заранее Паван.

Ответы [ 2 ]

0 голосов
/ 22 февраля 2012

Что в вашем методе PhoneApplicationPage_Loaded?

кроме отсутствующего конечного тега

   </phone:PhoneApplicationPage>  

в вашем фрагменте выше я смог собрать и запустить его в WP7 7.1. Мне пришлось опустить ваши ссылки Loaded и MouseLeftButtonUp, хотя у меня нет вашего полного кода.

0 голосов
/ 01 февраля 2012

Я не могу это закрепить, это почти общее сообщение, которое мало что говорит.

Вот что я бы сделал:

  1. Закомментируйте весь контенттак что у вас осталось <PhoneApplicationPage ...>
  2. Закомментируйте весь код C #, который зависит от только что закомментированного вами XAML
  3. Убедитесь, что приложение компилируется.
  4. Теперь медленно, шагшаг за шагом, добавьте элементы xaml обратно. Пока не найдете ошибочную строку.

Если 4. слишком сложно, вы можете отменить этот трюк;комментарий из по частям.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...