0

RichEditBox に入力されているものは何でも保存したい。以下は私の例です。「mytext.Text」を使用して TextBox を正常に使用できましたが、RichEditBox で確認できるオプションはありません。

 Private Async Function Button_Click(sender As Object, e As RoutedEventArgs) As Task
    Dim savePicker As New FileSavePicker
    savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary
    ' Dropdown of file types the user can save the file as

    savePicker.FileTypeChoices.Add(".txt", New List(Of String) From {".txt"})

    ' Default file name if the user does not type one in or select a file to replace
    savePicker.SuggestedFileName = "New Document"
    Dim file As StorageFile = Await savePicker.PickSaveFileAsync
    If file IsNot Nothing Then
        ' Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync

        CachedFileManager.DeferUpdates(file)
        ' Write to file
        Await FileIO.WriteTextAsync(file, txtfile.)
        ' Let Windows know that we are finished changing the file so the other app can update the remote version of the file.
        ' Completing updates may require windows to ask for user input
        Dim status As FileUpdateStatus = Await CachedFileManager.CompleteUpdatesAsync(file)
    End If

End Function
4

1 に答える 1

0

を仮定すると、コントロールのプロパティWindows.UI.Xaml.Controls.RichEditBoxのメソッドでテキストを取得できます。プロパティのメソッドを使用して、ドキュメントをストリームに直接書き込むこともできます。GetTextDocumentSaveToStreamDocument

于 2013-05-31T21:24:27.017 に答える