I have a page with GridView that contains 5 large rectangles:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<GridView Padding="120,90,46,40">
<GridView.Items>
<Rectangle Width="450" Height="300" Fill="Green" Opacity="0.7" />
<Rectangle Width="450" Height="300" Fill="Blue" Opacity="0.7" />
<Rectangle Width="450" Height="300" Fill="Orange" Opacity="0.7" />
<Rectangle Width="450" Height="300" Fill="Green" Opacity="0.7" />
<Rectangle Width="450" Height="300" Fill="Red" Opacity="0.7" />
</GridView.Items>
</GridView>
</Grid>
When scrolling the GridView to the left and the left rectangle is 'touching' the left side of the tablet screen then all tiles 'bounce' back and forth several times.
Is there any way how to disable this 'bounce' effect? What I have seen is that this 'bouncing' is related to the number of tiles and the width of the screen (in my case it is 1366). When I have more then 6 tiles, the effect is not visible.
The GridView and ScrollViewer have this bouncing effect to show a user he has reached the end of a list. if you don't have this effect it can feel for a user that scrolling is not responding. There is no way to change this.
When you have more then 6 tiles (and you actually have to scroll) this effect will be visible if you scroll to 1 side and then try to continue scrolling.
What do you mean with "back and forth" several times? this shouldn't happen it should only bounce back once. i've copied your code in an empty project and it does not bounce back and forth but only once. (do you have other code that could influence scrolling?)
Related
I create a star via an SVG polygon. It draws fine when the stroke width is 1, but with wider strokes, the bottom left (and only the bottom left) vertex gets cut off. Does anyone know why this happens (and how to fix it)?
The following snippets (which I displayed using https://www.w3schools.com 'try it') show the problem, both with the original star and with just the bottom 'arm' isolated as a simple triangle:
<svg height="200" width="200">
<polygon points="16,53 23,35 8,25 25,25 30,8 36,25 53,25 38,35 45,53 30,41" style="fill:none;stroke:purple;stroke-width:7" />
Sorry, your browser does not support inline SVG.
</svg>
<svg height="300" width="300">
<polygon points="120,164 64,212 92,140" style="fill:none;stroke:purple;stroke-width:9" />
Sorry, your browser does not support inline SVG.
</svg>
The default stroke-miterlimit is 4. You need a larger number than that because your star is quite pointy.
<svg height="200" width="200">
<polygon transform="translate(10, 10)" points="16,53 23,35 8,25 25,25 30,8 36,25 53,25 38,35 45,53 30,41" style="fill:none;stroke:purple;stroke-width:7; stroke-miterlimit:10" />
Sorry, your browser does not support inline SVG.
</svg>
I am creating some SVG image that consists of multiple rectangles. Those rectangles are one next to the other, the edges "touch" each other, some browsers (e.g., Chrome, Vivaldi) and image converters render unwanted tiny lines between those rectangles. Meanwhile, some other browsers (IE, Edge) displays the SVG in the desired way.
I checked the SVG in several browsers and in the Inkscape editor (I have exported the SVG into PNG, and the lines were also present).
I can solve there problem with adding some tiny overlap, but I don't like such a solution.
Is that a bug in SVG libraries used in browsers and Inkscape? Or shall I use some SVG feature to fix it?
Chrome example
Inkscape example
Edge example
<svg height="10cm" viewBox="0 0 10 10" width="10cm" xmlns="http://www.w3.org/2000/svg">
<rect fill="#ff00ff" height="1" opacity="1" width="1" x="1" y="1"/>
<rect fill="#ff00ff" height="1" opacity="1" width="1" x="2" y="1"/>
<rect fill="#ff00ff" height="1" opacity="1" width="1" x="3" y="1"/>
<rect fill="#167f81" height="1" opacity="1" width="1" x="1" y="2"/>
<rect fill="#167f81" height="1" opacity="1" width="1" x="2" y="2"/>
<rect fill="#167f81" height="1" opacity="1" width="1" x="3" y="2"/>
<rect fill="#000000" height="1" opacity="1" width="1" x="1" y="3"/>
<rect fill="#000000" height="1" opacity="1" width="1" x="2" y="3"/>
<rect fill="#000000" height="1" opacity="1" width="1" x="3" y="3"/>
</svg>
These edges are the result of tradeoffs renderers make when borders don't match with screen pixels or printer dots. You can state
shape-rendering="crispEdges"
to give a hint to the renderer to set the edges such that they should always coincide with pixels, even if the result of computing the conversion from userspace coordinates to real-world cm units would give a fraction.
Note that this is a hint that renderers may or may not honor.
In addition, some renderers have a bit of a hard time with rounding routines when dealing with small numbers. If you multiply all of your rects sizes and positions with ten, and consequently raise the viewBox size by the same factor, but leave the <svg> width and height unchanged, results may improve.
I am having a trouble regarding ScrollViewer in my Windows Phone application (Universal App).
I have a ScrollViewer like the followring:
<ScrollViewer x:Name="myScrollViewer" Grid.Row="1">
<StackPanel>
<TextBlock x:Name="myText"
Margin="12"
FontSize="30"
Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry."
TextWrapping="Wrap"
/>
<Rectangle Height="140"
Width="400"
Fill="Blue"
Margin="12"
/>
<Rectangle Height="140"
Width="400"
Fill="Red"
Margin="12"
/>
</StackPanel>
</ScrollViewer>
Now I am trying to get the Height of this ScrollViewer. In code behind (inside the Constructor), I have tried:
double d = myScrollViewer.ActualHeight;
double d = myScrollViewer.ScrollableHeight;
double d = myScrollViewer.Height;
I have also tried other height relevant methods to get the Height of the ScrollViewer. But in every case, I got NULL or 0 in the d. Is there any way, that will return the Actual Height or Working Height of the ScrollViewer?
You should be able to get ActualHeight of any framework element after Loaded event of Page. ActualHeight and ActualWidth are not set at the time of constructor or until the control is dynamically calculated/measured etc.
I try to crop image in windows phone 8 App.
I use following namespace
xmlns:y="clr-namespace:System.Windows.Media.Imaging;assembly=Microsoft.Phone"
And write content panel like this.
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Image HorizontalAlignment="Left" Height="200" Margin="97,153,0,0" VerticalAlignment="Top" Width="200">
<Image.Source>
<y:CroppedBitmap
SourceRect="30 0 75 50">
<y:CroppedBitmap.Source>
<BitmapImage UriSource="/Assets/image.jpg"/>
</y:CroppedBitmap.Source>
</y:CroppedBitmap>
</Image.Source>
</Image>
</Grid>
Error is occurred.
error : The tag 'CroppedBitmap' does not exist in XML namespace 'clr-namespace:System.Windows.Media.Imaging;assembly=Microsoft.Phone'.
If anyone can solve this or do this using another way. please help me.
Use WriteableBitmapExtension library instead which has inbuilt crop functionality.
http://writeablebitmapex.codeplex.com/
Here is my problem, fairly obvious: [img at bottom]
The problem, as you can see, is that the text (height and width) is nothing like the Height and Width of the compoent (Spark TextArea) that I have set via the Main.mxml file in Flex 4. This is pissing me off so much because nobody can tell me why this is happening, or how to fix it. Text is dynamically added to the TextArea as people send messages in the server, hence the valueCommit line.
I don't understand this, because I know it's not the fault of my fx:Script. I know this, because when I switch over to the Design tab of Adobe Flex Builder 4; the lines are just as messed up as in the screen shot.
I've been tearing my hair out (metaphorically) over this issue, please help me come to an answer.
<!-- State: interface -->
<s:TextArea id="incomingMessages" includeIn="interface"
heightInLines="{NaN}" widthInChars="{NaN}"
y="10" x="9" minWidth="426" minHeight="442"
text="Connected to Chat Paradise v5.00a, By CharlesBroughton."
valueCommit="incomingMessages_valueCommitHandler(event)"/>
<!-- Toolbar -->
<s:HGroup includeIn="interface" x="10" y="460" width="363" height="22">
<mx:ColorPicker id="tintColor" selectedColor="#FFFFFF" includeIn="interface"/>
<s:Label id="curname" height="22" width="100" text="<user>" fontSize="16" includeIn="interface"/>
<s:CheckBox label="AutoScroll" id="scrollToggle" selected="true"/>
<s:Button id="clearButton" width="60" height="22" label="Clear" click="incomingMessages.text = "";"/>
</s:HGroup>
<!-- end Toolbar -->
<s:Button id="sendMessage" width="60" height="22" label="SEND" includeIn="interface" x="375" y="460"/>
<s:TextArea id="outgoingMessages" x="10" y="480" maxChars="2048" editable="true" width="425" height="50" includeIn="interface" skinClass="graphite.skins.TextAreaSkin"/>
<s:List id="userlist" x="443" y="10" width="128" height="488" includeIn="interface" itemRenderer="userlistRenderer"/>
<s:ComboBox includeIn="interface" x="444" y="506" width="127" id="songs" selectedIndex="0"/>
<!-- end State: interface -->
Here is the FX:SCRIPT for incomingMessages_valueCommitHandler(event) if you care:
protected function incomingMessages_valueCommitHandler(event:FlexEvent):void
{
if (scrollToggle.selected)
incomingMessages.textDisplay.verticalScrollPosition = incomingMessages.textDisplay.maxHeight;
}
I'm not allowed to post images [less than 10 repute] so here is a link: Image Link
Edited to include the surrounding code as asked for. What you all don't seem to understand is that the text box is taking up the size I set it to, but the TEXT inside the text box is only taking up like 100px wide and high of the total text box area, please check the picture link.
Okay so, we found the problem, graphite.styles.TextAreaSkin ... WHAT WAS ADOBE SMOKING?
<s:Scroller id="scroller" left="0" top="0" right="0" bottom="0" minViewportInset="1" measuredSizeIncludesScrollBars="false">
<s:RichEditableText id="textDisplay"
lineBreak="toFit"
textAlign="left"
selectable="true"
verticalAlign="top"
paddingBottom="4"
paddingTop="4"
paddingLeft="4"
paddingRight="4"
height="125"
width="125"
maxWidth="125"
maxHeight="125"/>
</s:Scroller>
What type of component is the parent to your TextArea? Without knowing any of the surrounding mxml, you may want to set width and height to 100%. If that doesn't work, post some more of your mxml and we'll try to figure it out. Hope that helps.
As you said, this is a problem with the graphite textarea skin. I created a new skinClass for my textarea(based on graphite text area skin). and replaced the scroller and richeditabletext with the Spark text area ones. And added textAlign = "left". And it started working fine. Let me know if this helped. Thanks.