0

Hi i want to set a text to three textblocks from service url "http://www.findyourfate.com/rss/yearly-horoscope.asp?sign=Aries",which is a single string, I just want to split three strings and setting the text to three textblocks of text1,text2,text3.idone setting why i'm splitting means in single textblock not displaying full content because of this reason i thought to split into three strings.for first text block what i neede to display has been done sucessfulyy ,I tried to set for rest of the textblock but i'm stuck please help me to resolve this issue.I'm begginer to this windows 8 development please help me.

           try
            {

                XDocument xmlDoc = XDocument.Parse(e.Result);
                var result = xmlDoc.Descendants("channel");
                List<xmlList> _xmList = new List<xmlList>();
                foreach (var item in result)
                {
                    var node = item.Descendants("item");
                    //XDocument xdoc = XDocument.Load(e.Result);
                    foreach (var xElememt in node)
                    {
                        string description = xElememt.Element("description").Value;
                        MessageBox.Show("" + description.Length);

                        string input = description;
                        int pattern = input.IndexOf("CAREER");
                        int pattern1 = input.IndexOf("RELATIONSHIP");
                        int pattern2 = input.IndexOf("FINANCE");
                        string str1 = input.Substring(0,pattern);
                        string str2 = input.Substring(pattern,pattern1);
                        string str3 = input.Substring(pattern2);
                        text1.Text = str1;

                        text2.Text = str2;
                        text3.Text = str3;




                        }
rohini
  • 11
  • 4

2 Answers2

1

You could use the String.Split Method in order to split a string.

Reference: C# Split A String By Another String

Community
  • 1
  • 1
Kulasangar
  • 9,046
  • 5
  • 51
  • 82
1

You don't have need to split the string and also no need to use three textblocks, You can use RichTextBox control to show the information. It will show your full content of description

use the bellow code with scrollbar in .xaml page

          <ScrollViewer 
              VerticalScrollBarVisibility="Visible" 
              ManipulationMode="Control" 
              Height="400" 
              Margin="0,0,0,-13" >
                <RichTextBox TextAlignment="Justify"
                             IsReadOnly="True"
                             Margin="0,0,0,10">
                    <Paragraph Foreground="#626262"
                               FontSize="17"
                               FontStyle="Normal"
                               FontFamily="Regular"  >
                        <Run x:Name="txtDescription" />
                    </Paragraph>
                </RichTextBox>
        </ScrollViewer>

and set the value of description to txtDescription in .xaml.cs file

        txtDescription.Text = xElememt.Element("description").Value;
Charan Ghate
  • 1,384
  • 15
  • 32