Multiline Radiobutton - windows-phone-8

I've radio buttuons in my WP-8 application.
All contents of my radiobuttons are overlapping. I've fixed height and width but words are not wrapping to second line. How can I solve this problem?
Please do not say something like "\n" content is dynamic.

You are probably setting text to Content property as a string. But you can also use TextBlock.
XAML
<RadioButton>
<TextBlock Text="This is very long text that I want to wrap. Is it long enough?"
TextWrapping="Wrap"/>
</RadioButton>
C#
RadioButton rb = new RadioButton();
rb.Content = new TextBlock()
{
Text = "This is very long text that I want to wrap. Is it long enough?",
TextWrapping = TextWrapping.Wrap,
};
Result

Related

How to set qlabel text's opacity in PyQt?

I have a label and I want to set it html\css formatted text from text variable.
label = QtGui.QLabel()
text = '''<font face="tahoma" color="#45688E">THIS TEXT</font>'''
label.setText(text)
I need the word THIS to be colored with my color(#45688E) and word TEXT to be transparent.
The idea is that I want label to show only one word on screen, meanwhile I could programatically get two words.
How to do it?
Thank you.
Update1: photo
Code:
from PyQt4 import QtGui, QtCore
import sys
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.resize(300, 400)
window.setWindowTitle('TITLE1')
window_layout = QtGui.QVBoxLayout()
window.setLayout(window_layout)
label = QtGui.QLabel()
text = '''<font face="tahoma"><span style="color:#45688E">THIS</span><span style="opacity:0"> TEXTANOTHER_WORD</span></font>'''
label.setText(text)
window_layout.addWidget(label)
window.show()
sys.exit(app.exec_())
Wrap your first word in a span tag and style with a color. Add all other words in another span tag and set the opacity of the span tag to 0
'''<font face="tahoma"><span style="color:#45688E">THIS</span><span style="opacity:0">TEXTANOTHER_WORD</span></font>'''
Browser Snippet below
<font face="tahoma"><span style="color:#45688E">THIS</span><span style="opacity:0">TEXTANOTHER_WORD</span></font>
EDIT:
Solution 2
'''<font face="tahoma"><span style="color:#45688E">THIS</span><span style="display:none">TEXTANOTHER_WORD</span></font>'''
A somewhat odd solution with PyQT
Somewhat setting the color to transparent hides that text
style="color:transparent"
Example
text = '''<font face="tahoma" color="red" style="color:green;"><span>THIS</span><span style="color:transparent">TEXT</span></font>'''
Picture below

How can I get my Sharepoint Child Controls to align horizontally?

I am creating controls in a Web Part's overridden CreateChildControls() method.
My code is this (no pun intended):
this.Controls.Add(new LiteralControl("<h2>Duckbilled Platypus Unlimited</h2>"));
this.Controls.Add(new LiteralControl("<h3>Angle of Repose of Bill: "));
boxRequestDate = new TextBox();
this.Controls.Add(boxRequestDate);
this.Controls.Add(new LiteralControl("</h3>"));
this.Controls.Add(new LiteralControl("<h3>Venomosity/Lethality Quotient of Poison Toe: "));
boxPaymentAmount = new TextBox();
this.Controls.Add(boxPaymentAmount);
this.Controls.Add(new LiteralControl("</h3>"));
...and I see this:
What I want to see is the "Venomosity" LiteralControl and TextBox to the right of / horizontally aligned with the first LiteralControl and TextBox (to the right of them, not below them). How can I achieve this?
try something like this:
this.Controls.Add(new LiteralControl("<h2>Duckibilled Platypus Unlimited</h2>"));
this.Controls.Add(new LiteralControl("<h3 style='display: inline-block; width: 400px;'>Angle of Repose of Bill: </h3>"));
boxRequestDate = new TextBox();
this.Controls.Add(boxRequestDate);
this.Controls.Add(new LiteralControl("<br />"));
this.Controls.Add(new LiteralControl("<h3 style='display: inline-block; width: 400px;'>Venomosity/Lethality Quotient of Poison Toe: </h3>"));
boxPaymentAmount = new TextBox();
this.Controls.Add(boxPaymentAmount);
Please note that you cannot have a textbox inside of an h3 tag (via HTML rules). Also, it would be better to use a class inside of CSS instead of inline styles like this, but this way should work for you. It would also be better to handle the "break" with CSS instead of the "", but for a quick fix this will do it.

Showing html text in FlowDocumentReader

I have a FlowDocumentReader control in my application.
<FlowDocumentReader Document="{Binding FlowDocument}" Style="{DynamicResource FlowDocumentStyle}" />
And here's how I set the text to the FlowDocumentReader:
Paragraph paragraph = new Paragraph();
paragraph.Inlines.Add("some <b>book</b>");
FlowDocument.Blocks.Add(paragraph);
The problem is that 'book' isn't shown like html, the tags are visible in the wpf application.
I tried using this converter:
http://code.msdn.microsoft.com/windowsdesktop/XAML-to-HTML-Conversion-ed25a674/view/SourceCode
but then the text shown in my wpf application looks like this:
<FlowDocument xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph>some <Run FontWeight="bold">book</Run></Paragraph></FlowDocument>
and again it's not bold. How can I do this?
Use UI Elements to show formatted text and them to InlineUIContainer of Paragraph.
Paragraph paragraph = new Paragraph();
paragraph.Inlines.Add("some");
Label lb = new Label();
lb.FontWeight = FontWeights.Bold;
lb.Content = " Book";
paragraph.Inlines.Add(new InlineUIContainer(lb));
this.Doc.Document = new FlowDocument();
this.Doc.Document.Blocks.Add(paragraph);

img tag is not working properly in actionscript3 TextField

I have a TextField.
Here is a snippet:
this.textField = new TextField();
this.textField.defaultTextFormat = font.format;
this.textField.selectable = true;
this.textField.border = true;
this.textField.wordWrap = true;
this.textField.multiline = true;
And here is the method to add new line to the textField box:
this.textField.htmlText = 'some text <IMG SRC="http://gravitatestudio.com/wp-content/themes/gravitate/images/facebook.png">';
The issue is that an image is always placed UNDER text instead of the END OF THE TEXT.
Here is the trace(this.textField.htmlText) after html text has been added:
<P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="12" COLOR="#FFFFFF" LETTERSPACING="0" KERNING="0">some text <FONT SIZE="2"><IMG SRC="http://gravitatestudio.com/wp-content/themes/gravitate/images/facebook.png"> </FONT></FONT></P>
Also I need to add an image to any side of the text like a chat message using smiles (left, middle, right side of the text).
Any suggestions?
TextField html text is very limited and thats why Adobe released TLFTextFields which will give you much more control over the layout of elements in the field. I have personally used it and have made entire chats out of one textfield with images, links etc.
resource:
adobe: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/text/TLFTextField.html
tutorial:
http://flashsimulations.com/2010/09/10/handling-image-loading-in-tlf-textflow-and-textfield/

How can I wrap lines of text in an unordered list?

I have some nested tables in a containing "column" table. The bottom table just contains a multi-line text area where the user can post comments. When the user saves the page I want to capture each separate line of comment as an element in an unordered list. Here is the HTML:
<td><strong>Key Messages:</strong><asp:Label runat="server" ID="messagesLabel"></asp:Label>
<div id="messagesDiv" runat="server">
<asp:TextBox runat="server" ID="MessagesTextbox" Width="100%" TextMode="MultiLine" Height="100" Columns="10"></asp:TextBox>
<asp:Button runat="server" ID="clearMessages" Text="Clear Messages" OnClick="ClearMessages_Click" />
</div>
</td>
My problem is that when the unordered list is posted back to the page, very long lines stretch the table beyond the desired width. I would like to have longer comments wrap at some point while still remaining just one element in the list -- ie, one bullet. I have tried setting the MaxLength and Columns properties with no luck.
EDIT:
I tried the first suggestion using:
ul
{
width: 50px;
}
li
{
width: 50px;
}
but it had not effect on the layout. The layout did not change for any value of width.
I tried to use the second solution but I don't have the CSS property "word-wrap" available in my editor. I am programming in Visual Web Developer Express 2010 which supports CSS 2.1 so, as far as I understand, I should be able to set this property but I can't. I tried it anyway and it had no effect on the layout.
EDIT:
Here is how I am creating the list:
XmlDocument xdoc2 = new XmlDocument();
xdoc2.Load(messagesFileLocation);
XmlNodeList messagesList = xdoc2.GetElementsByTagName("message");
if (messagesList.Count > 0)
{
string unorderedList = "<ul>";
for (int i = 0; i < messagesList.Count; i++)
{
XmlNode node = messagesList.Item(i);
string message = node.InnerText.ToString();
unorderedList += "<li>" + message.ToString() + "</li>";
}
unorderedList += "</ul>";
messagesDiv.InnerHtml = unorderedList;
}
The user edits are actually saved to an XML file first and then posted back to the page.
Specify the width of the ul and li elements and your content should wrap. Also set the parent elements to a height:auto; so the height changes as the size of the content increases.
If you post more code, I can give you a better idea.
yes i think its possible check this
http://www.w3schools.com/cssref/css3_pr_word-wrap.asp
and this
http://webdesignerwall.com/tutorials/word-wrap-force-text-to-wrap