开发者

How to select a part of text from textfield on finger move on the screen in windows phone 7?

my requirement is this 开发者_JAVA技巧that i want to build an application where user can select a part of text from the textfield and can edit ,copy and paste.

Or i can say want to select the text of textbox with the finger move on the screen.

for selecting the text i already tried textbox1.Select(textbox1.SelectionStart,textbox1.SelectionLength);

but this doesn't work fine.

Is this possible? if yes then how can i do that?


Copy&paste functionality is added as native in January WP7 update. You can download update of developer tools, which adds this functionality into emulator.

After installing the dev tools update (or if you already have it), you can test this functionality as described on MSDN.

If you don't need any special behavior, this should be sufficient.


You can use the events from TextBox namely, ManipulationStarted, ManipulationCompleted and ManipulationDelta.

If u want to select all of the text the method is textBox.SelectAll(); but i think it would be real hard to pinpoint how much text you want to select.

for help on the events try here


As @jumbo says, this functionality was included in the January update to the tools - and it will "soon" be available on all phone - as soon as the "NoDo" release finally makes it out into the wild.

I would definitely recommend that you use the January tools now - and then wait for the release to hit the wild (it should be in the next 10 days)

If you really want to do your own implementation, then check out @MattLacey's excellent blog post and app - on http://blog.mrlacey.co.uk/2011/03/wp7clipboard-clipboard-api-for-wp7dev.html - the code will show you how he used touches to select text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜