Hy guys!
How can I set / access the DetailTextLabel of a StyledStringElement in MonoTouch.Dialog?
the second argument is the detail text value. Note that you have to specify a cell style (third argument) that supports the detailed text - the default cell style does not display a detail text value.
new StyledStringElement ("Default", "Invisible value", UITableViewCellStyle.Default),
new StyledStringElement ("Value1", "Aligned on each side", UITableViewCellStyle.Value1),
new StyledStringElement ("Value2", "Like the Addressbook", UITableViewCellStyle.Value2),
new StyledStringElement ("Subtitle", "Makes it sound more important", UITableViewCellStyle.Subtitle),
new StyledStringElement ("Subtitle", "Brown subtitle", UITableViewCellStyle.Subtitle) {
DetailColor = UIColor.Brown
}
See the MT.Dialog sample app for an example of this code in action.
Related
Good day all,
I have a simple Dialog started after click button, I post my code:
Dialog dialog;
super();
dialog = new Dialog("Dialog example");
dialog.addText(strFmt("Text to show"));
dialog.addText(strfmt("SecondText to show"));
dialog.run();
I will show a Dialog window loollike this :
It's possible to set the position from code the Text: Text to show ?
For example, if I want to centered position the second text how should I do?
I tried to put blanks in the code:
dialog.addText(strfmt(" Text to show"));
But nothing changes, and this I think not good method.
I saw any suggestions on Web but or I do not use well or is not suitable for me: Example-suggestions.
Exist a method to do what I want?
Thanks for help,
enjoy!
You can center the text using the form control:
Dialog dialog = new Dialog("Dialog example");
DialogText t1 = dialog.addText(strFmt("Text to show"));
DialogText t2 = dialog.addText(strfmt("SecondText to show"));
FormStaticTextControl c1 = t1.control();
c1.widthMode(FormWidth::ColumnWidth);
c1.alignment(FormAlignment::Center);
dialog.run();
The first control is now centered (to the surrounding group).
You have to give it ColumnWidth, otherwise the control would have the minimum size and the centering would have no effect.
After Search
I found this sample how to display bar value on top of bar javafx, But that when bar separated on the category axis so each category data has a single bar and Listener can be added to that data (Category).
But with StackedBarChart each category consists of StackedBar.
I try that code simple based on the #jewelsea code.
That solution work prefect if all series are symmetric and contain all the categories.
But with non-symmetric series
ObservableList<StackedBarChart.Series> barChartData = FXCollections.observableArrayList(
new StackedBarChart.Series("Region 1", FXCollections.observableArrayList(
new StackedBarChart.Data(years[0], 567d),
new StackedBarChart.Data(years[1], 1292d),
new StackedBarChart.Data(years[2], 1292d))),
new StackedBarChart.Series("Region 2", FXCollections.observableArrayList(
new StackedBarChart.Data(years[0], 956),
new StackedBarChart.Data(years[1], 1665),
new StackedBarChart.Data(years[2], 2559))),
new StackedBarChart.Series("Region 3", FXCollections.observableArrayList(
new StackedBarChart.Data(years[0], 1154),
//new StackedBarChart.Data(years[1], 1927),// series names Region 3(which is the last series on the chart data) doesn't exist category years[1] "2008".
new StackedBarChart.Data(years[2], 2774))));
We will miss Text on top of category 2008.
Any help are welcome.
It's missing because you comment it out:
//new StackedBarChart.Data(years[1], 1927),// series names Region 3(which is the last series on the chart data) doesn't exist category years[1] "2008".
That second parameter is the "1927" title. This is technically the Y-Axis parameter. You need to keep that line in order to show that "1927". Check out the API:
http://docs.oracle.com/javafx/2/api/javafx/scene/chart/StackedBarChart.html
You may need to put your "titles" up another way. Use a text class and add it on top of the StackedBarChart.Series objects.
The title of rows in table cells is set as follows.
var source = new MvxStandardTableViewSource(TableView, "TitleText FullName");
How is a subtitle text set along with the TitleText?
If you are using a standard cell type which has a subtitle, then you can use DetailText - see the property in MvxStandardTableViewCell.cs#L73
e.g.
var source = new MvxStandardTableViewSource(
TableView,
UITableViewCellStyle.Subtitle,
"MyCellId",
"TitleText FullName; DetailText Address");
Obviously the standard cell types are fairly limited in what they can display - for more advanced applications, it's best to switch to custom cell types. There are several articles and videos about how to do this - see http://mvvmcross.wordpress.com
I have an MVC3 C# .Net web app. I am using Aspose.Words to create an MS Word document. I have a requirement to not include tables in the document. However, on several lines of the document the alignment of the text is mis-aligned depending on the width of the text.
For example:
This looks good
Proposal Name: My Proposal Date:04/24/2012
This does not
Proposal Name: My Prop Date:04/24/2012
It should be
Proposal Name: My Prop Date:04/24/2012
Based on the width of the first bit of text, I need to calculate the width in pixels (I think) and insert a TAB if necessary.
Any ideas how to do this?
you can use Graphics.MeasureString function which gives you the width of your string in pixels based on your font. for more info go Here
Cheers,
Ehsan
The following code example returns the bounding rectangle of the current entity relative to the page top left corner.
Document doc = new Document(MyDir + "in.docx");
LayoutCollector layoutCollector = new LayoutCollector(doc);
LayoutEnumerator layoutEnumerator = new LayoutEnumerator(doc);
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
{
var renderObject = layoutCollector.GetEntity(para);
layoutEnumerator.Current = renderObject;
RectangleF location = layoutEnumerator.Rectangle;
Console.WriteLine(location);
}
src: https://www.aspose.com/community/forums/thread/541215/replace-run-text-with-string-of-spaces-of-same-pixel-length.aspx
Consider something like this:
new RootElement ("Root"){
new Section ("Section A") {
new EntryElement("Element in A")
}
new Section ("Section B") {
new EntryElement("Element in B")
}
}
and Monotouch.Dialog will create you TableView with two sections. Now I want the second section to be located not right under the first section but rather at very bottom of the screen. How can I do that?
It seems you can trick Monotouch.Dialog by defining empty HeaderView for the section. It will expand the space between sections. Something like this:
lastSection.HeaderView = new UIView(new RectangleF(0,0,0,80));
I'm not sure though this is the right approach. Worked for me.
I do not believe MonoTouch.Dialog can do this of the box. You will need to:
Define a large transparent UITableViewCell subclass.
Define an ‘Element’ subclass and override it’s GetCell(...) method to provide the cell you subclassed above.
Implement IElementSizing on the element above and implement GetHeight(...) to describe the height of the transparent cell between the first and last cells.
Create an empty Section with the Element subclass between your top EntryElement and the bottom EntryElement section.
The resulting code would look something like this:
this.Root = new RootElement ("Root") {
new Section ("Section A") {
new EntryElement("Element in A")
}
new Section("") {
new EmptyElement()
}
new Section ("Section B") {
new EntryElement("Element in B")
}
};