[Q] RichtTextBox control, add Xaml text on runtime - Windows Phone 7 Q&A, Help & Troubleshooting

I have a string variable with:
Code:
<Paragraph>Hello <Run FontWeight="bold">bold text</Run> and <Run FontStyle="italic">italic text.</Run> Nice!</Paragraph>
How can I set this text to a RichtTextBox on runtime? My tries ended up in the above text as plaintext in the RichTextBox.

Try RTF or working with the Blocks collection
If the WP7 RichTextBox control is anything like other such controls Microsoft built over the years, it may work with RTF internally:
http://en.wikipedia.org/wiki/Rich_Text_Format
It's a long shot, but you might try that.
Alternative: Try to work with the Blocks collection, like they do here:
http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.blocks(v=vs.95).aspx

Thank you rbrunner7
That the solution for me was to use the RichTextBox.Xaml property and insert Xaml code into it. Unfortunately this wasn't ideal for my app, so currently I'm using the Webbrowser control

Hmm, the very first link returned by Google has all info you need: http://www.silverlightshow.net/items/Working-with-the-Silverlight-Rich-Text-Box-control.aspx

Nice link
That's really quite a good article about this control.
Interesting how different this "Rich Text" control is from earlier such controls from Microsoft.
I suspected another one of those WP7 Silverlight controls that are mostly wrappers around native controls like the TextBox control. But this looks like a true Silverlight control written in C# instead.
So there might be no native RTF based Rich Text control in WP7? Was there one in Windows Mobile?

Related

Possible convert my iPhone-app to Android?

Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
porting your iphone add to android
hi there,
i'm a android programmer and did many games already. you can see my games at:
not sure you still need help to port your iphone app to android. may be you can send me the source code. i can do it for you. very easy for me.
Tony Chan
[email protected]
Android uses java syntax and java libraries
so if you like java, then you would probably like android
layouts are done in XML
chingy1788 said:
Android uses java syntax and java libraries
so if you like java, then you would probably like android
layouts are done in XML
Click to expand...
Click to collapse
hehe well said
I don't think anybody can tell you what you need to do. Just start by reading through all of this: http://developer.android.com/guide/topics/fundamentals.html and you should be able to handle this.
Note: your application appears to be trivial.
One thing that I suggest is that you forget about locally-stored web pages and just rewrite those pages in Android/Java. The reason I suggest this is that unlike apple, you can't make any assumptions about what browser the user has installed (if any), or what rendering engine their browser happens to have, or javascript engine, etc. There are AT LEAST three different rendering engines in use on Android, including khtml, gecko, and presto. There are at LEAST two different JAVASCRIPT engines, including SquirrelFish and V8, and soon you will be able to add SpiderMonkey to this list (when Firefox launches). And no, you can't force your application to call on a particular browser since this would violate the modularity designed into the platform.
DANNEMAN101 said:
Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
Click to expand...
Click to collapse
look at the NDK
Freedomcaller said:
look at the NDK
Click to expand...
Click to collapse
The NDK is *NOT APPLICABLE*.
Why don't you create a converter from iPhone to Android? There are few Italian app.. only this is better than Android for Italian user.. but I love Android!
I have an app that has been created for android, and I need help creating it for the iphone. I'll share the source code if someone will create the app for me please.
DANNEMAN101 said:
Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
Click to expand...
Click to collapse
Is it possible to post this in the Q&A and not development section?
sparksco said:
Is it possible to post this in the Q&A and not development section?
Click to expand...
Click to collapse
This is from the first half of 2009, I highly doubt that they care where it should be posted (now).
Converting iPhone app to Android will be greate.
I would like to have All My Recipes iphone app in my Galaxy Tab
It was be great if somebody can port the secret of mana game from iphone to android ! =)

User definable bluetooth remote control

Hi guys,
for a few months now I am looking for a remote control for my Diamond. The best solution I found so far is the PPC Tablet Remote Control Suite, but this does not have all the features I need.
What I am looking for is a tool which allows me to define my own buttons (PPC Tablet does this) and also to create a script behind (PPC Tablet only sends key strokes). E.g. I want to have a full media center conrol app, including the control of my favorite programs, DVBViewer, Foobar2000 and the KMPlayer. Everyone of those has already several shortcuts. I can address them from PPC Tablet, but I can not start the programs. I also cannot shutdown Windows or in-/decrease the system volume if needed. This would only be possible if the tool sends a command like {volume_down} to a server processing tool, which then has a database where this command is linked to lowering the system volume (a kind of scripting language). My infrared remote has that ability, but I want to get rid of it since it only controls the DVBViewer in a correct manner.
I already heard of a tool called "Girder", but am not sure whether this is the right thing for me.
I hope I did not scare you off by this quite long text and would be very happy if someone could recommend a suitable application to me.
Regards and thanks in advance!
did you try Salling Clicker? you can create your own (java) scripts for it and a lot of scripts are shared on the salling clicker forum...
Hi,
thanks for the quick reply. Yes, I have been to the homepage, but have never installed it (I thought there may be an easier - code less - solution out there). I just dont like java very much, but I'll give it a shot.
Thanks!
check out theire forum, a lot of custom scripts are submitted and working very well! you can quite easily script yourself by starting from some other script and modifying it to your needs...
A quick update on this one:
http://forum.xda-developers.com/showthread.php?t=574593
We are trying to get as many contributors as possible at the moment, be it for beta testing or active programming.

Best Practise Android <-> Webservice

I'm planning to build an app which has a client and a service part. but i have no plan how i should realize the communication. (should be as standardconform as possible).
I looked a bit around and found for now two ways, where each one has pros and contras.
kSOAP
Pro:
Standardconform
Servicedescription
Class Generation
Contra:
External Library
Slow
JSON
Pro:
Lightweight and fast
Buildin Library
Works in combination with a MVC (symfony)
Contra:
No Standard
No Servicedescription
No Class Generation
Kind regards
Ghost
I would use JSON. Most social networks use JSON for communication with apps. Just have a small HTTP server running and send the commands through POST methods and let the server return the JSON objects.
First off, JSON is a open standard, as defined in RFC 4627
Second off, the comparsion doesn't really hold imo, (k)SOAP is a structured information exchange protocol, JSON is merely a data serializer, like YAML. What they try to accomplish are to very different things. As for the added code that you'd have to write, unlike class generation handling JSON/YAML messages can be done very easily in one factory design-pattern setup. Hand the factory a message, it produces an instance of a specific class, if your messages are properly abstracted, this shouldn't be hard.
with JSON i meant to build such an information exchange around JSON. but this would be something selfmade and not a standard. while the information exchange with soap is a standard and each programmer would be able to build easily without much docu an client for that service. after i want to release that software under the gpl and plan the service as something open like jabber, it would make sense to design the data exchange between service and client as easy as possible.
GhostOfTheNet said:
with JSON i meant to build such an information exchange around JSON. but this would be something selfmade and not a standard. while the information exchange with soap is a standard and each programmer would be able to build easily without much docu an client for that service. after i want to release that software under the gpl and plan the service as something open like jabber, it would make sense to design the data exchange between service and client as easy as possible.
Click to expand...
Click to collapse
Go with JSON. Just describe your API / exchanged JSON-Objects and every programmer would be fine with that.
so it seems, that noone thinks that soap is a googd thing... so i'll use json, thanks
if soap is too heavy, try xml-rpc, its like a simple version of soap
Is it already implemented in the android libs? Or is there somewhere an androitd lib for that out?
Regards
Sent from my HTC Desire using XDA App
GhostOfTheNet said:
Is it already implemented in the android libs? Or is there somewhere an androitd lib for that out?
Regards
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
No, but the xml-rpc protocol is very simple you could easily write a small class to generate the required xml and send it over http
http://en.wikipedia.org/wiki/XML-RPC
Edit:
theres java classes linked to on that wikipedia page, that should work on android

Text substitution app

Hi,
Does anyone know of a text substitution app, that will allow me to type a short phrase into any text box, and replace it with a longer one?
e.g. I type ".sig" --> replaced with my signature (name, email address etc).
I know there are apps that will do this for SMS, but I was hoping to find one that allows more generalized substitution (across the whole OS). Maybe a keyboard replacement?
The closest I've found is Clipper, which lets me save "snippets" and choose them from a list.
Thanks in advance,
Lee
+1
...Some form of Autohotkey port to Android would rock.
I'm also looking for something similar.
So in the meantime, I use Textspansion (Free) and I combine it with Swipepad that enables me to access Textspansion (a bit easier - although does place a icon on the notification bar).
Textspansion is a great app, but a pervasive Text substitution app would be even better and even better if it had some form of macro recording and playback ability.
I missed having something like this that exists in Windows Mobile in the form of Calligrapher from Phatware, which has both Text subsititution and ability for you to program actions, clicks etc.

[Q] Control the cursor

Hi I succeed to finish my code of simple viewer PC screen. Work with WP7
See the video
http://www.youtube.com/watch?v=cCwsuj7Hcno&list=HL1330329890&feature=mh_lolz
Now I will go to try how control the mouse?
About my app I use socket to connect to the server, no RDP protool and its word good. I try it on different machines and networks (@IP) and work perfect.
My app is a last year project so any idea about how to control the cursor.
This probably should have been in the same thread, but anyhow...
It depends on how your protocol is designed. Currently, all the data is pushed from the PC to the phone. To control the cursor, your phone needs to push data to the PC, which means that the PC server app needs to check for data from the phone app.
Sensing a touch on the phone is easy. Sending those coordinates over the network is pretty easy as well; you figured out sending video so I assume you can handle this part. On the PC, you'll want to receive those coordinates and then multiply them back out to their equivalent positions at the PC's resolution. Then you need to move the mouse cursor. There are Windows APIs for doing this, but I've never messed with them. They might be exposed to .NET, but I'm guessing that you'll need to make a call into native code (this is pretty easy, though; look up P/Invoke). Clicking can be implemented by having the phone detect that you tapped the same spot where the cursor already is, and having it send a different message to the server.
The messages will need to be determined by you, as the designer of the protocol. I do recommend using different messages for "move the cursor to here" and "click where the cursor is now." As for when to send the message, that also depends on how you implemented the app. If the entire transmission of the screen frame is one long socket send/receive, you'll have to exchange cursor commands between frames. If you do multiple smaller chunks, you can check for a cursom command and update the position or click as appropriate. Another alternative is to create two socket connections, and have the second one be used for cusor commands. I don't recommend this, though - it's not needed, it takes more code, and although I feel that everybody *should* learn multi-threaded netcode development, I'm not sure it what you want to work on now.
I am really confused
But I will try to get the coordinate of cursor from PC and move it on WP7 screen at first, if I succeed I will develop code tap (click), double tap and drag.
I am really confused
No one can help!!!!!!!!!!!!
Google should be your best helper - try to work with google first.
On WP7 app side you need to grab tap position, translate it to desktop coordinates and send data to the server. On the server side you may use Win32 API function SendInput() http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx
SendInput can emulate mouse and keyboard events.
P.S. As for youtube video: try your project on the real device, using WiFi or 3G, and you will understand what RDP protocol was built for
Yes I use Google for that,its the best search engine
I understand that use the coordinates to locate the position, and send it from WP7 to PC.
But my question is how any sample code can hep?

Categories

Resources