IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Phone .NET Discussion :

Invalid XAML !


Sujet :

Windows Phone .NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre extrêmement actif Avatar de DotNET74
    Homme Profil pro
    Watch R&D Engineer & Apprenti .NET
    Inscrit en
    Août 2003
    Messages
    1 986
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Watch R&D Engineer & Apprenti .NET

    Informations forums :
    Inscription : Août 2003
    Messages : 1 986
    Par défaut Invalid XAML !
    Hello,

    En reprenant mon ancienne application j'ai un Invalid XAML qui apparaît sur le code suivant:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
                <Controls:PivotItem x:Name="PivotItemCountries" Header="{Binding MainPagePivotItemCountriesTitle}">
                    <Grid Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <ListBox x:Name="ListBoxCountries" ItemsSource="{Binding Path=Countries}" SelectedItem="{Binding SelectedCountry, Mode=TwoWay}" Grid.Row="1">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="32"></RowDefinition>
                                            <RowDefinition Height="32"></RowDefinition>
                                            <RowDefinition Height="32"></RowDefinition>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="96"></ColumnDefinition>
                                            <ColumnDefinition Width="140"></ColumnDefinition>
                                            <ColumnDefinition Width="80"></ColumnDefinition>
                                            <ColumnDefinition Width="80"></ColumnDefinition>
                                            <ColumnDefinition Width="64"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <Image Source="{Binding Path=IconFullName, Converter={StaticResource StringToBitmapConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="3" Grid.Row="0" Grid.Column="0"></Image>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                </Controls:PivotItem>
    Alors qu'avant J'avais pas ce problème. Quand je dis avant c'est sous VS 2010.

    Si j'enlève le converter il n'y a plus de soucis ....

    Merci

  2. #2
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    436
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2006
    Messages : 436
    Par défaut
    Bonjour, peux tu nous donner le code de ton converter ainsi que le type de ta propriété path bindé ?

  3. #3
    Membre extrêmement actif Avatar de DotNET74
    Homme Profil pro
    Watch R&D Engineer & Apprenti .NET
    Inscrit en
    Août 2003
    Messages
    1 986
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Watch R&D Engineer & Apprenti .NET

    Informations forums :
    Inscription : Août 2003
    Messages : 1 986
    Par défaut
    Alors voici le code du Converter:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    			public object Convert(object value,Type targetType,object parameter,System.Globalization.CultureInfo culture)
    			{
    				if(value is string)
    				{
    					string CurrentFileFullName=value.ToString();
    					var Store=System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
    					if(Store==null)
    					{
    						return null;
    					}
    					if(CurrentFileFullName==string.Empty)
    					{
    						BitmapImage CurrentBitmap=new BitmapImage();
    						CurrentBitmap.UriSource=new System.Uri("/Resources/Icons/Matte White Vintage.png",UriKind.Relative);
    						return CurrentBitmap;
    					}
    					else
    					{
    						if(!Store.FileExists(CurrentFileFullName)||CurrentFileFullName==string.Empty)
    						{
    							BitmapImage CurrentBitmap=new BitmapImage();
    							CurrentBitmap.UriSource=new System.Uri(CurrentFileFullName,UriKind.Relative);
    							return CurrentBitmap;
    						}
    						else
    						{
    							using(System.IO.IsolatedStorage.IsolatedStorageFileStream CurrentIsolatedStorageStream=Store.OpenFile(CurrentFileFullName,FileMode.Open))
    							{
    								if(CurrentIsolatedStorageStream.Length>0)
    								{
    									try
    									{
     										BitmapImage CurrentBitmap=new BitmapImage();
    										CurrentBitmap.SetSource(CurrentIsolatedStorageStream);
    										CurrentIsolatedStorageStream.Close();
    										return CurrentBitmap;
    									}
    									catch(Exception)
    									{
    										BitmapImage CurrentBitmap=new BitmapImage();
    										CurrentBitmap.UriSource=new System.Uri("/Resources/Icons/Matte White Vintage.png",UriKind.Relative);
    										return CurrentBitmap;
    									}
    								}
    								else
    								{
    									return null;
    								}
    							}
    						}
    					}
    				}
    				else
    				{
    					return value;
    				}
    			}
     
    			public object ConvertBack(object value,Type targetType,object parameter,System.Globalization.CultureInfo culture)
    			{
    				throw new NotImplementedException();
    			}
    Et le type de la propriété bindé est un string pour l'image.

    Mais je pense que le problème est ailleur car même avec une ligne de ce type cela génère l'erreur:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
                                            <TextBlock Text="{Binding Path=Main.MainPagePivotItemVineyardsTitle, Source={StaticResource Locator}}" FontSize="{StaticResource PhoneFontSizeNormal}"></TextBlock>
    Alors que si je retire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    , Source={StaticResource Locator}
    plus de problème ....

    Merci

  4. #4
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    436
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2006
    Messages : 436
    Par défaut
    Tu as essayé de récupérer le dernier toolkit (enfin la DLL où tu as le ctrl pivot) ?

    Quand tu mets un point d'arrêt dans le constructeur, tu as quoi comme exception exactement au InitializeCompononent ?

    As-tu l'erreur juste au niveau de conception de l'UI sous visual ou bien pareil au lancement de l'appli ?

    (j'ai déjà eu qq xaml qui ne passaient pas dans visual mais qui une fois lancés ne posaient plus de problème) dans ce cas rajoute dans ton converter un if Design.IsInDesignMode then return "path d'une image récupérable en locale"

  5. #5
    Membre extrêmement actif Avatar de DotNET74
    Homme Profil pro
    Watch R&D Engineer & Apprenti .NET
    Inscrit en
    Août 2003
    Messages
    1 986
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Watch R&D Engineer & Apprenti .NET

    Informations forums :
    Inscription : Août 2003
    Messages : 1 986
    Par défaut
    Et bien ça ne compile pas dès que je mets le converter ou la source !!!

  6. #6
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    436
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2006
    Messages : 436
    Par défaut
    si tu vires le code du converter et que tu retournes directement l'url, ça crash aussi ?

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Message Invalid XAML
    Par DotNET74 dans le forum Windows Phone
    Réponses: 1
    Dernier message: 27/01/2013, 18h49
  2. [struts] invalidation de session
    Par rocco dans le forum Struts 1
    Réponses: 16
    Dernier message: 25/06/2004, 15h40
  3. [JSP] probleme d'invalidation de session
    Par Jovial dans le forum Servlets/JSP
    Réponses: 11
    Dernier message: 04/06/2004, 15h27
  4. Requête invalide
    Par hubble dans le forum Outils
    Réponses: 4
    Dernier message: 16/02/2004, 16h48
  5. [XMLRAD] invalid character type
    Par Sylvain James dans le forum XMLRAD
    Réponses: 4
    Dernier message: 10/12/2002, 07h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo