I
read text file in Isolated Storage and I select myList. But I want to delete it.
How to delete string line.
<ListBox Margin="0,0,-12,0" x:Name="myList" SelectionChanged="listF_select"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Width="311"> <TextBlock Text="{Binding Msg}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
StreamReader reader = new StreamReader(new IsolatedStorageFileStream(strFileName, FileMode.Open, isoStore)); string rawData = reader.ReadToEnd(); reader.Close(); string[] sep = new string[] { "\r\n" }; string[] arrData = rawData.Split(sep, StringSplitOptions.RemoveEmptyEntries); List<Message> myContact = new List<Message>(); foreach (var strLine in arrData) { myContact.Add(new Message(strLine.ToString())); } this.myList.ItemsSource = myContact;
private void listF_select(object sender, SelectionChangedEventArgs e)
{
if (listFr.SelectedItem != null)
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
string strFileName = "/FavoriteList.txt";
string strline = listFr.SelectedItem.ToString();
StreamReader reader = strline(new IsolatedStorageFileStream(strFileName, FileMode.Open, isoStore));
ClearValue.
Close();
}
else
{
MessageBox.Show("eeeeeeeeeeeeeeeeeee");
}
}