简体   繁体   中英

Hyperlink in textbox same as like message composer screen in windows phone

I had an textbox in which user can enter text and there was an list box below the text box which shows the collections of objects of a class. When user selects any one of the list box item i am displaying the list box item in the textbox using the text property in the selected event of the list box. Now my concern here is i want to make the selected list box item as hyperlink in textbox which is clickable same as like in message composer in windows phone. And user can continue typing the text in the textbox after item was selected to select the next list box item. Can any one help me to find the solution.

yea its clear now. Can you check

this link ' http://www.jayway.com/2011/10/05/wp7-link-in-text-with-richtextbox-on-mango/ '


Hope this will help you.

You can try this way.

        <TextBlock x:Name="tbref" Visibility="Collapsed"/>
        <RichTextBox >
            <RichTextBox.Template>
                <ControlTemplate>
                    <StackPanel Orientation="Horizontal">
                        <HyperlinkButton  x:Name="txtnam" Content="{Binding  Text,ElementName=tbref}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                        <TextBox  Width="200"/>
                    </StackPanel>
                </ControlTemplate>
            </RichTextBox.Template>
        </RichTextBox>

selection event handler

        private void lst_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
         var selectedString = lst.SelectedItem;
         tbref.Text = selectedString.ToString(); 
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM