Instagram like RichEditBox in uwp

Ali Noshahi 26 Reputation points
2020-01-21T22:35:23.743+00:00

Hi everyone,

Is it possible to have RichEditBox that starts typing every Paragraph / Sentence in an origin Font size and keep going till font size is higher than X value and adding every word cause a little font size decreasing to align the text in one line exactly like what Instagram did.
I've uploaded a little video of what I want.
I couldn't attach here

https://www.mediafire.com/file/4xp2ngx7s4lbhm6/recordedVideo~1.mp4/file

Universal Windows Platform (UWP)
0 comments No comments
{count} vote

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,856 Reputation points
    2020-01-22T07:06:51.92+00:00

    Instagram like RichEditBox in uwp

    There is no such control in uwp platform, currently there is a workaround that insert Textbox into ViewBox that will set the text fontsize automatically. Then make new TextBlock with text and insert it into the root layout.

    private string resault;  
    private int count = 0;  
    private void TextBox_TextChanged(object sender, TextChangedEventArgs e)  
    {  
        var tb = sender as TextBox;  
        resault = tb.Text;        
    }  
      
    private void TextBox_KeyDown(object sender, KeyRoutedEventArgs e)  
    {  
        if(e.Key== VirtualKey.Enter)  
        {  
            var textbox = new TextBlock() {  
            VerticalAlignment = VerticalAlignment.Center,  
            HorizontalAlignment = HorizontalAlignment.Center,  
            Text= resault  
            };            
            RootLayout.Children.Insert(count++, textbox);  
            Tbox.Text = string.Empty;  
        }  
    }  
    

    alt text

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Franck_1999 1 Reputation point
    2021-01-28T17:03:24.283+00:00

    this is a good solution but like Nico say its hard to design .fontsize is 14 it's good

    0 comments No comments