Search code examples
.netc#-4.0windows-phone-8windows-phone-8.1windows-phone

Windows Phone 8.1 TextBox


I want to get image from a my windows phone into a textbox or Rich TextBlock . As Rich TextBox does not supported in windows phone 8.1 . So the problem is that Rich TextBlock does not allow to get user input . As I just want to get the user input and also image in a same textbox. Thankyou


Solution

  •     <StackPanel Name="Stack_image" >
        <StackPanel.Background>
            <ImageBrush ImageSource="{Binding}"></ImageBrush>
        </StackPanel.Background>
            <TextBox x:Name="email"  />
       </StackPanel>
    

    and in behind code:

            ImageEncodingProperties imgFormat = ImageEncodingProperties.CreateJpeg();
            // a file to save a photo
            StorageFile file = await          ApplicationData.Current.LocalFolder.CreateFileAsync(
                    "Photo.jpg", CreationCollisionOption.ReplaceExisting);
    
            await takePhotoManager.CapturePhotoToStorageFileAsync(imgFormat, file);
    
            IRandomAccessStream filestream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
    
            BitmapImage imagetobind = new BitmapImage();
                imagetobind.SetSource(filestream);
    
                Stack_image.DataContext = imagetobind;