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 :

Suppression des balises Html dans mon flux rss


Sujet :

Windows Phone .NET

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    75
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut Suppression des balises Html dans mon flux rss
    Bonjour à tous,
    Je souhaiterai affiché mon flux rss mon application,
    ca fonctionne sauf qu'il laisse des balises Html:
    Voici mon code:
    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
    private void Feed(object Sender, DownloadStringCompletedEventArgs e)
            {
                XElement _xml;
                try
                {
                    if (!e.Cancelled)
                    {
                        _xml = XElement.Parse(e.Result);
                        Results.Items.Clear();
                        foreach (XElement value in _xml.Elements("channel").Elements("item"))
                        {
                            FeedItem _item = new FeedItem();
                            _item.Title = value.Element("title").Value;
                            _item.Description = Regex.Replace(value.Element("description").Value,
                            @"<(.|\n)*?>", String.Empty);
                            Results.Items.Add(_item);
                        }
                    }
                }
                catch
                {
                    // Ignore Errors
                }
    Voici le résultat:

    Une idée pour une solution ?
    D'avance merci
    Guillaume

  2. #2
    Membre émérite
    Avatar de Samuel Blanchard
    Homme Profil pro
    Expert .NET
    Inscrit en
    Février 2010
    Messages
    1 504
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France

    Informations professionnelles :
    Activité : Expert .NET

    Informations forums :
    Inscription : Février 2010
    Messages : 1 504
    Points : 2 682
    Points
    2 682
    Par défaut
    Tu peux essayer ça :

    Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    string chaine = HttpUtility.HtmlDecode(chaineHTML);
    .
    Pas de question technique en MP, merci.
    .
    Un emulator Gameboy Color pour Windows Phone ?
    c'est moi qui l'ai fait

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    75
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut
    Impeccable, Merci Beaucoup. Par contre, il n'affiche pas toute la description. J'ai vérifié avec un breakpoint, tout est bien stocké dans la variable. Et j'ai bien mis TextWrapping="Wrap" dans mon fichier Xaml.
    Comme on peut le voir sur l'image, il coupe et affcihe un espace.
    Une idée du problème ?
    D'avance merci

  4. #4
    Membre émérite
    Avatar de Samuel Blanchard
    Homme Profil pro
    Expert .NET
    Inscrit en
    Février 2010
    Messages
    1 504
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France

    Informations professionnelles :
    Activité : Expert .NET

    Informations forums :
    Inscription : Février 2010
    Messages : 1 504
    Points : 2 682
    Points
    2 682
    Par défaut
    Montre un peu de XAML si tu veux bien
    .
    Pas de question technique en MP, merci.
    .
    Un emulator Gameboy Color pour Windows Phone ?
    c'est moi qui l'ai fait

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    75
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut
    Voci:
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    <phone:PhoneApplicationPage 
        x:Class="SatE.MainPage"
        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"
        mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
        FontFamily="{StaticResource PhoneFontFamilyNormal}"
        FontSize="{StaticResource PhoneFontSizeNormal}"
        Foreground="{StaticResource PhoneForegroundBrush}"
        SupportedOrientations="Portrait" Orientation="Portrait"
        shell:SystemTray.IsVisible="True">
     
        <!--LayoutRoot est la grille racine où tout le contenu de la page est placé-->
        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
     
            <!--TitlePanel contient le nom de l application et le titre de la page-->
            <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
                <TextBlock x:Name="ApplicationTitle" Text="Société Aquariophile et terrariophille d Ecaussinnes" Style="{StaticResource PhoneTextNormalStyle}"/>
                <TextBlock x:Name="PageTitle" Text="SATE ASBL" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
            </StackPanel>
     
            <!--ContentPanel - place additional content here-->
            <Grid x:Name="ContentGrid" Grid.Row="1">
                <Grid x:Name="ContentMain">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="80"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid x:Name="Toolbar" Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <!-- Toolbar -->                    
                    </Grid>
                    <!-- Content -->
                    <ScrollViewer Grid.Row="1" BorderThickness="0">
                        <ItemsControl Name="Results">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <HyperlinkButton   NavigateUri="{Binding Path=Link}" Content="{Binding Path=Title}"/>
                                        <TextBlock TextWrapping="Wrap"  Text="{Binding Path=Description}"/>
                                        <TextBlock  Text="{Binding Path=Published}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </Grid>
            </Grid>
        </Grid>
     
        <!--Exemple de code illustrant l utilisation d ApplicationBar-->
        <!--<phone:PhoneApplicationPage.ApplicationBar>
            <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
                <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Bouton 1"/>
                <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Bouton 2"/>
                <shell:ApplicationBar.MenuItems>
                    <shell:ApplicationBarMenuItem Text="ÉlémentMenu 1"/>
                    <shell:ApplicationBarMenuItem Text="ÉlémentMenu 2"/>
                </shell:ApplicationBar.MenuItems>
            </shell:ApplicationBar>
        </phone:PhoneApplicationPage.ApplicationBar>-->
     
    </phone:PhoneApplicationPage>

  6. #6
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2008
    Messages
    242
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2008
    Messages : 242
    Points : 296
    Points
    296
    Par défaut
    Il faut définir une width à ton textbox ;-)

  7. #7
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    75
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut
    J'ai pas de TextBox :s

    Et si tu parles des TextBlock c 'est mieux qu'ils soient en wrap, ainsi ils s adapte au contenu
    non ?

  8. #8
    Membre expérimenté 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 : 51
    Localisation : France

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

    Informations forums :
    Inscription : Août 2003
    Messages : 1 986
    Points : 1 453
    Points
    1 453
    Par défaut
    A mon avis c'est le contraire !

    c'est le contenu qui est découpé si ça dépasse la valeur Width du TextBlock
    La Théorie c'est quand on comprends tout mais que rien ne fonctionne.
    La Pratique c'est quand tout fonctionne mais qu'on ne sait pas pourquoi !

    Si vous aimez ma réponse, cliquez sur la main verte Merci

  9. #9
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2008
    Messages
    242
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2008
    Messages : 242
    Points : 296
    Points
    296
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <TextBlock TextWrapping="Wrap"  Text="{Binding Path=Description}"/>
    <TextBlock  Text="{Binding Path=Published}"/>
    Textblock excuse! :-)

  10. #10
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    75
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut
    Mais le problème est que je ne peux pas fixer une taille car elle est variable en fonction du flux reçu :s

  11. #11
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    57
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 57
    Points : 65
    Points
    65
    Par défaut
    Si ça se trouve ça vient de la limitation des 2000 pixels du textblock.

    Il faut que tu découpes en plusieurs textblock donc

  12. #12
    Membre émérite
    Avatar de Samuel Blanchard
    Homme Profil pro
    Expert .NET
    Inscrit en
    Février 2010
    Messages
    1 504
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France

    Informations professionnelles :
    Activité : Expert .NET

    Informations forums :
    Inscription : Février 2010
    Messages : 1 504
    Points : 2 682
    Points
    2 682
    Par défaut
    C'est fort possible en effet MajorLamda.
    Voici un article pour contrer le probleme en creant un control ScrollableTextBlock

    http://blogs.msdn.com/b/priozersk/ar...k-for-wp7.aspx
    .
    Pas de question technique en MP, merci.
    .
    Un emulator Gameboy Color pour Windows Phone ?
    c'est moi qui l'ai fait

  13. #13
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2008
    Messages
    242
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2008
    Messages : 242
    Points : 296
    Points
    296
    Par défaut
    Je vois pas où est le problème.

    Tu reçois un flux dynamique, les textblock s'adaptent en hauteur.

    Après la largeur, tu la fixe à la largeur de grid principale, tu gardes ton textwrap, et sa va passer niquel.

    J'avais ce soucis pour une application sur des conseils de Poker. J'ai mis un scrollbarViewer, fixé la largueur de mes textblock, laissé en wrap, et c'est passé niquel!
    D'ailleur, si je m'en souviens bien, c'est Rudy qui m'avait indiqué la solution.

Discussions similaires

  1. Réponses: 2
    Dernier message: 21/07/2008, 16h17
  2. [XSLT] inclure des balises html dans xml
    Par paty03 dans le forum XSL/XSLT/XPATH
    Réponses: 7
    Dernier message: 25/02/2008, 14h13
  3. Insérer des Balises HTML dans un champ mémo
    Par Heureux-oli dans le forum IHM
    Réponses: 18
    Dernier message: 21/03/2007, 20h05
  4. Afficher des balises HTML dans une chaine javascript
    Par lapaupiette dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 07/03/2007, 10h19
  5. problème balise html dans un flux rss
    Par irons dans le forum XML/XSL et SOAP
    Réponses: 5
    Dernier message: 22/05/2006, 11h19

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