How to pass specific value to the converter parameter? - xaml

How I send an static value inside ConverterParameter such as a number?
<Label Style="{DynamicResource ListItemDetailTextStyle}" Text="{Binding Information, Converter={StaticResource CutStringConverter}, ConverterParameter={100}}" />

You probably need to include the type then. So either do it inline like this: ConverterParameter={x:Int32 100}.
Or write it more verbose:
<Label>
<Label.Text>
<Binding Path="Information" Converter="{StaticResource CutStringConverter}">
<Binding.ConverterParameter>
<x:Int32>100</x:Int32>
</Binding.ConverterParameter>
</Binding>
</Label.Text>
</Label>
Or, to be complete, add a static resource to your page (or whatever the container is), like:
<ContentPage.Resources>
<x:Int32 x:Key="IntHundred">100</x:Int32>
</ContentPage.Resources>
And reference that: ConverterParameter={StaticResource IntHundred}

Related

Convert DateTime to LongDateString in XAML

How to convert the DateTime property,
<Label Text="{Binding PaymentDate}"></Label>
<Label Text="{Binding PaymentDate, StringFormat=D}"></Label>
Please let me know what string format to use. The above logic didn't work.
<Label Text="{Binding PaymentDate, StringFormat=D}"></Label>
You have a couple of option:
Option 1:
You do a String format in the XAML:
<Label Text="{Binding ActualDate, StringFormat='{0:MMMM d, yyyy HH:mm}'}" Font="15,Bold" />
Option 2:
In you model have a string property e.g. DateFormatted which is a GET property that returns the string formatted representation of your Actual Date property:
public string DateFormatted { get { return ActualDate.ToLongDateString(); } }

Is it possible to set a static resource to the same value as another in XAML?

Is it possible to set a static resource to the value of another static resource?
As it is possible to reference a static resource from another type of static resource it should be possible, but I can't find out how.
I.e something like this:
<!-- My first value -->
<Color x:Key="MyBlueColor">#ff7db3b6</Color>
<!-- This works -->
<SolidColorBrush x:Key="MyBlueColorBrush" Color="{StaticResource MyBlueColor}"/>
<!-- But how do I do this? -->
<Color x:Key="MyOtherNameForBlueColor">{StaticResource BlueColor}</Color>
You can do this
<Color x:Key="MyBlueColor">#ff7db3b6</Color>
<StaticResource x:Key="MyOtherNameForBlueColor" ResourceKey="MyBlueColor" />

Creating fixed FCE with fluidcontent

Width this code i can define content:
<flux:flexform.section name="columns">
<flux:flexform.object name="column" label="column">
<flux:flexform.field.input name="demo" label="Demo field" />
</flux:flexform.object>
</flux:flexform.section>
<flux:flexform.grid>
<flux:flexform.grid.row>
<f:for each="{columns}" as="sectionObject" iteration="iteration">
<flux:flexform.grid.column>
<flux:flexform.content name="column{iteration.cycle}" label="Column {iteration.cycle}" />
</flux:flexform.grid.column>
</f:for>
</flux:flexform.grid.row>
</flux:flexform.grid>
This is flexible. I can Add new "Content Areas" through the section. But this is not what I want. I Want to define a very fixed two-column and a three-column FCE. My editor should not have to decide how many columns to use.
I am missing something like:
<flux:flexform.field.contentArea name="col1" label="Column 1" />
<flux:flexform.field.contentArea name="col2" label="Column 2" />
<flux:flexform.grid>
<flux:flexform.grid.row>
<flux:flexform.grid.column>
<flux:flexform.content name="col1" />
</flux:flexform.grid.column>
<flux:flexform.grid.column>
<flux:flexform.content name="col2" />
</flux:flexform.grid.column>
</flux:flexform.grid>
</flux:flexform.grid.row>
Thank you for your hint to the right direction.
You are very close to the solution with the code you already have. In this example I will use the new ViewHelper names - but you can get the same result using the old names as in your example. Which is which, should be easy to spot (note: you had a typo in your code example which I edited, rgid used instead of grid - such a typo would cause Flux to error out):
<flux:grid>
<flux:grid.row>
<flux:grid.column>
<flux:content name="col1" label="Nice name for column 1" />
</flux:grid.column>
<flux:grid.column>
<flux:content name="col2" label="Column 2" />
</flux:grid.column>
</flux:grid>
</flux:grid.row>
And remove the flux:form.section with object inside it - you don't need this when you make a statically defined grid.
Then to render this grid:
<flux:content.render area="col1" /> and so on.

Exporting More Info Row to PDF using LogiXML not showing up

I am having some trouble trying to export a report to PDF format. I have an action report element to show the more info row, meaning, it is hidden by default (Show Mode : None) until the user clicks a particular element. However, this is creating problems when trying to export since, when I check the option in the Target.PDF element as to "Keep Show Elements", I'm coming up with a blank page. Any help would be appreciated. Thank you.
The best way to troubleshoot these types of export problems is to start simplifying the definition file so that you can easily isolate the issue. For your reports, I might start by remarking the MoreInfoRow so that it's effectively not impacting the export.
-Does the report export to PDF once the MoreInfoRow is gone? If yes, the we can assume the problem has to do with the MoreInfoRow. If no, then there is a different issue. If you've removed the MoreInfoRow and it still doesn't export properly, I might guess that the problem is either : 1) You're passing incorrect showmodes with the export or 2) the report requires parameters to be passed with the Action PDF as well that aren't getting set properly.
For additional details on ShowModes, I'd visit:
http://devnet.logixml.com/rdPage.aspx?rdReport=Article&dnDocID=1043
If the MoreInfoRow is the problem, you might try simplifying the report, in general. Here's a quick example that you can try:
<Report ID="Default" SavedBy="test">
<StyleSheet Theme="SimpleBlue" />
<Body>
<Label Caption="Export PDF" Class="ThemeLinkButton">
<Action Type="PDF">
<Target Type="PDF" KeepShowElements="True" Report="CurrentReport" />
</Action>
</Label>
<LineBreak LineCount="3" />
<DataTable ID="dtExport" Width="450">
<DataLayer Type="Static" ID="myData1">
<StaticDataRow id="001" name="Sample Row 1" />
<StaticDataRow id="002" name="Sample Row 2" />
<StaticDataRow id="003" name="Sample Row 3" />
</DataLayer>
<DataTableColumn ID="colid" Header="id">
<Label ID="lblid" Caption="#Data.id~">
<Action Type="ShowElement" ElementID="mirTest" ID="actShowMir" />
</Label>
</DataTableColumn>
<DataTableColumn ID="colname" Header="name">
<Label ID="lblname" Caption="#Data.name~" />
</DataTableColumn>
<MoreInfoRow ShowModes="None" ID="mirTest">
<Label Caption="This is the More Info Row" />
</MoreInfoRow>
</DataTable>
</Body>
</Report>

Ordering the execution of WiX SetProperty actions

I have a sequence of SetProperty actions which rely on each other. Here is a simplified example:
<SetProperty Id="A" Before="AppSearch" Value="Hello" />
<SetProperty Id="B" Before="AppSearch" Value="[A] world!" />
Property A needs to be set before property B in this case, so that the value of B becomes "Hello world!".
Since WiX doesn't define an attribute to set the custom action name in this case, I don't have a name to use in the Before or After attributes.
I did notice that the execution order of these actions matches the alphabetical order of the property names, but that feels like an implementation detail that I should not rely on.
How do I cleanly enforce the order of SetProperty custom actions?
You can also use the “Action” attribute of the SetProperty element to nail down the name of the custom action. This becomes essential if you wish to set the same property in two distinct SetProperty actions as it removes ambiguous “SetXXX” action names.
For example:
<SetProperty Id="A" Action="MyFirstAction" Before="AppSearch" Value="Hello" />
<SetProperty Id="B" Action="MySecondAction" After="MyFirstAction" Value="[A] world!" />
<SetProperty Id="A" Action="MyThirdAction" After ="MySecondAction" Value="Goodbye cruel world!" />
I used orca to discover the names generated for the custom actions. They turn out to be SetA and SetB. The following does what I want:
<SetProperty Id="A" Before="AppSearch" Value="Hello" />
<SetProperty Id="B" After="SetA" Value="[A] world!" />