How to use ScrollView control in vertical line Windows Phone 8.1 - windows-runtime

I want my scrollview not "scrolling" down and yes from right and left side, like a Pivot!
<ScrollViewer Height="100" VerticalAlignment="Top"
VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled"
AllowDrop="False" BringIntoViewOnFocusChange="True"
HorizontalScrollMode="Disabled" IsHoldingEnabled="True" >
<Grid Grid.Row="1" x:Name="ContentRoot" Height="90" Width="386" />
</ScrollViewer>

<ScrollViewer Height="100" VerticalAlignment="Top" VerticalScrollMode="Disabled" HorizontalScrollBarVisibility="Auto"
HorizontalScrollMode="Enabled" Background="Blue">
<TextBlock FontSize="50" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" />
</ScrollViewer>

Related

Issue with AMP default height values being toggled

I have an amp carousel with some hide/show content at the bottom. I am using amp-bind to dynamically hide and show some extra content as well as adjust the height value of the carousel itself so that the content can be seen.
The markup is something like this, but with a couple more slides with similar content:
<amp-carousel
[height]="visible ? 720 : 550"
height="550"
width="400"
layout="responsive"
type="slides">
<div class="carousel__slide">
<p>Text content here</p>
<button [text]="visible ? 'See Less' : 'See More'"
on="tap:AMP.setState({visible: !visible})">See More</button>
<ul [class]="visible ? 'show' : 'hide'" class="hide">
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
</ul>
</div>
</amp-carousel>
With that mark I get the following error:
amp-bind: Default value for [height] does not match first expression result (550). This can result in unexpected behavior after the next state change.​​​
I tried adding a default value for height before the carousel but that didn't seem to help
<amp-state id="props">
<script type="application/json">
{
"height": "550"
}
</script>
</amp-state>
I tried passing it both a number and string, with brackets and without but none of it seems to work
You're missing single quotes '. Try this:
<amp-carousel
[height]="visible ? '720' : '550'"
height="550"
width="400"
layout="responsive"
type="slides">
<div class="carousel__slide">
<p>Text content here</p>
<button [text]="visible ? 'See Less' : 'See More'"
on="tap:AMP.setState({visible: !visible})">See More</button>
<ul [class]="visible ? 'show' : 'hide'" class="hide">
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li>
</ul>
</div>
</amp-carousel>
After discussing with the AMP team, they informed me that's it's actually a bug with the validation in developer mode
Bug has been filed here: https://github.com/ampproject/amphtml/issues/12028

Fixed Size SVG Background Image

I have a shape I'm trying to put on top of a text box with a background image. This shape will go in different sized containers and scale responsively. The issue I'm having is the background image scales as well, and I would like for it to stay the same size without using a clip path. Please see the code for what I'm talking about. This is driving me crazy!
.container {
width: 75%;
}
.box {
background-image: url("https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg");
padding-top: 5px;
padding-left: 25px;
padding-right: 20px;
padding-bottom: 5px;
margin-top: -5px;
}
p {
color: white;
}
<div class="container">
<svg width="100%" height="auto" viewBox="375 265 1268 45.3">
<defs>
<pattern id="img1" height="30%" width="30%"
patternContentUnits="objectBoundingBox"
viewBox="0 0 1 1" preserveAspectRatio="xMidYMid slice">
<image height="1" width="1" preserveAspectRatio="xMidYMid slice"
xlink:href="https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg" />
</pattern>
</defs>
<path d="M369,291.8v19.7h1280v-22.7c0,0-137-21.6-277-21.6c-308,0-534,34.9-726,34.9C460,302.2,369,291.8,369,291.8z" fill="url(#img1)" />
</svg>
<div class="box">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nec tamen ille erat sapiens quis enim hoc aut quando aut ubi aut unde
</p>
</div>
If you change the percentage size of the container, you'll see what I'm talking about.
Thanks for the help!
For a start you will need to get rid of the viewBox in the SVG. That causes the SVG to get scaled, and that affects anything in the SVG. You'll also want the pattern to be 1:1, so that means switching to patternContentUnits="userSpaceOnUse" and have the pattern use the image at actual size.
We are also using overflow:hidden so that the non-scaling SVG will not force the parent SVG to be wider.
This gets you close. The pattern is now 1:1 but it doesn't exactly line up with the HTML one because they have differing pattern origins. You can adjust that by tweaking the x and y attributes of the pattern until it lines up correctly. I'll leave that to you.
.container {
width: 75%;
overflow: hidden;
}
.box {
background-image: url("https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg");
padding-top: 5px;
padding-left: 25px;
padding-right: 20px;
padding-bottom: 5px;
margin-top: -5px;
}
p {
color: white;
}
<div class="container">
<svg width="1268" height="45.3">
<defs>
<pattern id="img1" patternUnits="userSpaceOnUse" width="881" height="192">
<image width="881" height="192"
xlink:href="https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg" />
</pattern>
</defs>
<path transform="translate(-375 -265)"
d="M369,291.8v19.7h1280v-22.7c0,0-137-21.6-277-21.6c-308,0-534,34.9-726,34.9C460,302.2,369,291.8,369,291.8z" fill="url(#img1)" />
</svg>
<div class="box">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nec tamen ille erat sapiens quis enim hoc aut quando aut ubi aut unde
</p>
</div>

Line Wrap description text in a compilationTemplate's relatedContent area in TVML

How can I wrap the description text in the relatedContent area of a compilationTemplate?
My description tag:
<description style="tv-text-style: none; font-size:36; font-weight:regular; word-wrap:break-word;">lorem ipsum dolor sit amet consectetur adipiscing elit</description>
Full template:
var Template = function() { return `<?xml version="1.0" encoding="UTF-8" ?>
<document>
<compilationTemplate theme="light">
<list>
<relatedContent>
<itemBanner>
<heroImg src="${this.BASEURL}images/shows/bates/BRANDHD2398_AEN_BATE_168121_TVE_000_2398_60_20160303_00_S3_REV_HD_1920x1080-16x9.jpg" />
<description style="tv-text-style: none; font-size:36; font-weight:regular; word-wrap:break-word;">lorem ipsum dolor sit amet consectetur adipiscing elit</description>
</itemBanner>
</relatedContent>
<header>
<title>Bates Motel</title>
<subtitle>Season 4</subtitle>
</header>
<section>
<listItemLockup>
<ordinal minLength="2">1</ordinal>
<title>A Danger to Himself and Others</title>
<decorationLabel>11:14</decorationLabel>
</listItemLockup>
< !-- ... -- >
</section>
</list>
</compilationTemplate>
</document>`
}
The text size changes, but the description truncates instead of wrapping to the next line.
Modify pre-defined description area with min-height, max-height styles? with tv-text-max-lines. Example in https://github.com/iBaa/PlexConnectApp/blob/master/PlexConnectApp/TVMLTemplates/Fanart/Movie_PrePlay.xml, see class description and later usage.
(Edited 14Apr16 based on comment and double-check)

ScrollBar issue with StageWebView in Flash Builder Mobile project

I am developing flex mobile application and I am using the StageWebView Class to show formatted html content. The only issue I am having is that when I view my application on the mobile, I am not having any scrollbars so that I can move up or down to see the contents of my html.
Note that my html file contains formatted text, images and hyperlinks.
Is there any way to show scrollbars?
Or any other better way to display such data on my mobile, other than StageWebView?
Thanks in advance.
Are you sure your StageWebView has correct dimensions (width and height)?
Here a View from an app using StageWebView to display usage help:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
viewActivate="openSWV(event)"
viewDeactivate="closeSWV(event)"
title="Help">
<s:states>
<s:State name="portrait"/>
<s:State name="landscape"/>
</s:states>
<s:navigationContent>
<s:Button label="Back" click="navigator.popView()"/>
</s:navigationContent>
<fx:Declarations>
<fx:String id="_help">
<![CDATA[
<html>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
</ul>
<table border=1 width=100%>
<tr bgcolor="#CCCCCC">
<th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th>
</tr>
<tr>
<th>6</th><td>2</td><td>4</td><td>2</td>
</tr>
<tr>
<th>7</th><td>4</td><td>2</td><td>1</td>
</tr>
<tr>
<th>8</th><td>6</td><td>1*</td><td>1</td>
</tr>
<tr>
<th>Blah</th><td>10</td><td>-</td><td>-</td>
</tr>
<tr>
<th>9</th><td>8</td><td>1*</td><td>1</td>
</tr>
<tr>
<th>10</th><td>10</td><td>0</td><td>0</td>
</tr>
</table>
<p><i>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</i></p>
</body>
</html>
]]>
</fx:String>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
import mx.events.FlexEvent;
import flash.media.StageWebView;
private var _swv:StageWebView;
private function openSWV(event:Event=null):void {
_swv = new StageWebView();
stage.addEventListener(Event.RESIZE, resizeSWV);
_swv.stage = stage;
resizeSWV();
_swv.loadString(_help);
}
private function closeSWV(event:Event=null):void {
stage.removeEventListener(Event.RESIZE, resizeSWV);
if (! _swv)
return;
_swv.dispose();
_swv = null;
}
private function resizeSWV(event:Event=null):void {
if (! _swv)
return;
var scale:Number = scale = runtimeDPI / applicationDPI;
// align to the right-bottom corner
_swv.viewPort = new Rectangle(stage.stageWidth - scale * width, stage.stageHeight - scale * height, scale * width, scale * height);
}
]]>
</fx:Script>
</s:View>
It displays scrollbars on Android, iOS and BB10 just fine...

I want to display HTML page in view using flex 4.5 in mobile application so how can i use?

I have created 3 view in one of them i want to display static HTML page. How can i?
Here a View from my app using StageWebView:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
viewActivate="openSWV(event)"
viewDeactivate="closeSWV(event)"
title="Help">
<fx:Declarations>
<s:MultiDPIBitmapSource id="BACK"
source160dpi="#Embed('assets/icons/low-res/back.png')"
source240dpi="#Embed('assets/icons/mid-res/back.png')"
source320dpi="#Embed('assets/icons/high-res/back.png')"/>
</fx:Declarations>
<s:states>
<s:State name="portrait"/>
<s:State name="landscape"/>
</s:states>
<s:navigationContent>
<s:Button icon="{BACK}" label.landscape="Back" click="navigator.popView()"/>
</s:navigationContent>
<fx:Declarations>
<fx:String id="_help">
<![CDATA[
<html>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
</ul>
<table border=1 width=100%>
<tr bgcolor="#CCCCCC">
<th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th>
</tr>
<tr>
<th>6</th><td>2</td><td>4</td><td>2</td>
</tr>
<tr>
<th>7</th><td>4</td><td>2</td><td>1</td>
</tr>
<tr>
<th>8</th><td>6</td><td>1*</td><td>1</td>
</tr>
<tr>
<th>Blah</th><td>10</td><td>-</td><td>-</td>
</tr>
<tr>
<th>9</th><td>8</td><td>1*</td><td>1</td>
</tr>
<tr>
<th>10</th><td>10</td><td>0</td><td>0</td>
</tr>
</table>
<p><i>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</i></p>
</body>
</html>
]]>
</fx:String>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
import mx.events.FlexEvent;
import flash.media.StageWebView;
private var _swv:StageWebView;
private function openSWV(event:Event=null):void {
_swv = new StageWebView();
stage.addEventListener(Event.RESIZE, resizeSWV);
_swv.stage = stage;
resizeSWV();
_swv.loadString(_help);
}
private function closeSWV(event:Event=null):void {
stage.removeEventListener(Event.RESIZE, resizeSWV);
if (! _swv)
return;
_swv.dispose();
_swv = null;
}
private function resizeSWV(event:Event=null):void {
if (! _swv)
return;
var scale:Number = scale = runtimeDPI / applicationDPI;
// align to the right-bottom corner
_swv.viewPort = new Rectangle(stage.stageWidth - scale * width, stage.stageHeight - scale * height, scale * width, scale * height);
}
]]>
</fx:Script>
</s:View>
You can do this by using a StageWebView
An implementation of this can be found at
http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/
Cheers