In my Windows Store App, when I press the arrow buttons on the keyboard to go to the next or previous item in my FlipView, a dashed line border appears around the FlipView to indicate that it has focus. This looks ugly and serves no purpose in my app. It looks like this border is hidden in other apps that I have looked at.
The SelectionBorderVisibility property is not available in WinRT. I was able to hide the border by defining a custom FlipView style and setting the Stroke property inside one of the rectangle to null as follows.
<Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="1" StrokeEndLineCap="Square" Stroke="{x:Null}" StrokeDashArray="1,1"/>
However, I'd rather not have to define an entire custom FlipView style if possible. Is there any other way to do this?
Related
I'm trying to make a material design inspired Tab component, and I'm having a lot of trouble getting a bottom border to show up on the selected tab. I understand that the best way to do this is to override the Tab style in the theme, but there's no way to set just a bottom border there. I even went so far as to use an ActionListener to set the border when the tab is clicked, but then the border only flashes for a moment, as it seems the UIID gets reset immediately after being selected.
I'm looking for an effect similar to the Skype android app, where the current tab is 'underlined' at all times.
How can I make the border appear?
You can set a 9 piece border in the style that has a solid or transparent/translucent color and a line on the bottom.
No need to subclass.
I have a stackpanel a TextBlock. When i tap on it,I want to display a couple of text boxes right below TextBlock and within the stack panel. And when I tap on TextBlock again the textboxes should not be visible. How can I accompalish this by just using XAML?
By just using XAML and nothing else, you can't. You have to have either a code behind or a view model bound to the page.
Add all textboxes to the StackPanel and set their Visibility to Collapsed. Also give each one a name using the x:Name property. As for your TextBlock, set IsHitTestVisible to true and add Tap handler. In the tap handler change the visibility of the previously added and named TextBoxes.
In case you want to use MVVM, bind visibility to some bool value and add converter from bool to visibility. Also add an event to command trigger to the text block element and handle it in your view model - there you will toggle the same bool property that all those text boxes are bound to.
I have a custom skin for spark buttons.
I need to control the alpha of the image i set as the button icon using the skin. i.e. I need the image to change its opacity with change in the button states.
Is there a workaround, using the skin class, rather than writing event handlers??
When you create new button skin, you can see generated mxml markup there that sets different gradients for rects depending on states.
So, you can just set alpha values for different states in your image like
<s:Image alpha.disabled="0.1" alpha.over="0.4" /> and so on.
Update:
Now I understand your problem. Icon( which is set by icon property) is defined and managed by code in spark.skins.SparkButtonSkin, and your generated skin will extend that class.
Id of control that renders icon is iconDisplay of type BitmapImage.
So, you can change its behavior by adding following code to your generated skin:
<s:BitmapImage id="iconDisplay"
alpha.down="0.5"
alpha.over="0.7"
alpha.up="0"
/>
It will not add another icon.
I am trying to set the softKeyboardType to email but when ever i use skinClass="spark.skins.mobile.TextAreaSkin" it doesn't change it but when i take off skinClass="spark.skins.mobile.TextAreaSkin" it does work. The problem is i need the skinClass="spark.skins.mobile.TextAreaSkin" class to allow my application so scroll with out it the text does not stay with in the bounds of the text input boxes. Has anyone seen this problem or another fix the the scrolling problem?
Code examples
<s:TextInput softKeyboardType="email" id="id1" width="100%" skinClass="spark.skins.mobile.TextInputSkin" />
<s:TextArea softKeyboardType="email" id="id2" height="400" width="100%" skinClass="spark.skins.mobile.TextAreaSkin" />
Thank for the help,
Justin
I've checked mobiletheme default.css in flex 4.6 sdk
adobe is using different skins for TextInput and TextArea components
TextArea
{
...
skinClass: ClassReference("spark.skins.mobile.StageTextAreaSkin");
}
TextInput
{
...
skinClass: ClassReference("spark.skins.mobile.StageTextInputSkin");
}
so I think you should use StageTextAreaSkin or StageTextInputSkin as a skinClass for corresponding components
softKeyboardType will work in this case but text position problem will stay, I think you will need to change/fix StageTextAreaSkin or StageTextInputSkin sources for your scrolling
Confronted with this issue, I came up with a workaround which worked in my case.
Use default skin, set your softKeyboardType.
While doing layout for your screen, create a section which contains the uppermost part of your screen and which you can easily collaps or toggle its includeInLayout property, so when you do that, it will make your TextInput or TextArea to appear over the keyboard, bypassing the scroller for that purpose.
Then, when your field receives focus, in focusIn handler, you collaps or toggle this section. This does two good things: first, it lifts your field over the keyboard, and second, it removes focus from your field (at least in my case it did, not sure 100%, if it doesn't, then shift focus manually). This is good because when you set focus on your field once again (yourfield.setFocus()), the cursor will appear where you want it, within the bounds of your field.
Once done typing, you restore top section to its original state from focusOut or softKeyboardDeactivate handlers.
Hope this helps...
seems like it's flex 4.6 bug
http://forums.adobe.com/message/4122095
I have two components being absolutely positioned within a container (they are MapSymbols on an ILOG Elixir map, if that helps). Each component is a VBox with an Image and a Label. Images have functionality tied to the Click event; labels do not.
The problem is when 2 items are positioned so that the label of one is above the icon of another in the z-index, so that the label eats any mouseOver and mouseDown events. Bubbling doesn't help since it bubbles from the label to the vbox to the container, never hitting the lower element. I can't set the vbox to mouseChildren="false", since that keeps the image from getting clicked, as well.
Is there anything I can do with this? The positioning and number of components is data-driven, not something I have control over.
EDIT: some clarification. Each distinct component is structured like this:
<VBox>
<Image source="whatever" click="handleClick()"/>
<Label text="{item.label}/>
</VBox>
The problem is when two of these vboxes are placed close together -- the label of one box may be above the image of the other box, blocking you from interacting with the lower one.
(source: imnotpete.com)
In that example the second label blocks the lower icon -- mouse events are only passed when you interact with the lower half of that icon.
Setting the VBox to mouseEnabled="false" and the Label to mouseEnabled="false" mouseChildren="false" doesn't appear to have any effect - the label still blocks the lower image from receiving mouse events.
The z-index is determined by the display tree, with higher-indexed child DisplayObjects shown above their siblings, so this is how it works already.
What you should be doing is putting your label inside your button as a child, but if you just want to run with the hack, you want:
label.mouseEnabled=false;
label.mouseChildren=false;
label.mouseEnabled = false; would make the area behind the label clickable, isn't that what you need ?