Show/hide stack panel child elements - windows-phone-8

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.

Related

How can I expand my longListSelector item when clicked?

I want to add an icon and another textblock to my data template when the item in longListSelector is tapped. Also, when another item is tapped, I want to remove this icon and textblock from previously selected item and expand new selected item. How can I achieve that?
Options 1 (Modify it through Code-Behind)
You can modify my ListBox collapse code to do what you want : ListBox Collapse. You need to change the Border to a <Grid> then loop through the .Children to hide/show the extra textblock and icon. Always save the reference to the current SelectedItem so when the SelectionChanged event fires you can hide the previous selection and then show the newer Selected Item.
Option 2: Create An ItemControl you can use as part of the Item.DataTemplate of the LongListSelector
Using this method, you want to create your own VisualState (Selected, NotSelected.. or whatever you want).
In the Selected (StoryBoard) you change the extra Textblock/Icon's Visibility to Visible.
In the NotSelected (StoryBoard) you change the extra Textblock/Icon's Visibility to Collapse.
Then when the SelectionChanged Event on the LongListSelector, loop through your ItemSources and compare it to the SelectedItem.
If the current item is the SelectedItem then VisualStateManager.GoToState(your_control, "Selected") else VisualStateManager.GoToState(your_control, "NotSelected")
This will complete the whole interaction that you want.

Remove Button on Right-Click Menu Option

A "Remove" context menu item is to be shown when the user right-clicks on a button. If the user clicks on the "Remove" option, that button should be removed from its Tile parent container. How would I implement this using Flex 3 and ActionScript 3?
You need to create a custom flash.ui.ContextMenu, to which is added a ContextMenuItem corresponding to the Remove text that you want the user to select.
Add an event listener to this ContextMenuItem, which will handle removing the item clicked. Here's one way to implement the removal:
private function removeItemHandler(event:ContextMenuEvent):void
{
((event.mouseTarget as DisplayObject).parent as DisplayObjectContainer).removeChild((event.mouseTarget as DisplayObject));
Alert.show((event.mouseTarget.toString() + " has been removed."),"Display Object Removed");
}
Finally, make sure to set the contextMenu property of all the components (InteractiveObject's) you want to be removable to the custom ContextMenu you created.
Note
The code of above corresponds to Flex 3, since the question specified that. For Flex 4, one would use IVisualElement, IVisualElementContainer, and the removeElement method, in place of DisplayObject, DisplayObjectContainer, and the removeChild method, respectively.

Reporting Services incorrect icon on show/hide group

I have created a parameter on a report that allows the user to open all the group details or hide group details when the report is run.
This works, but when you run the report and select to expand the groups, the little icon use use to show/hide on the report is a + symbol instead of a - one.
While the actual report is right, i can see it confusing the users somewhat as it looks like there is something hidden, when in fact its all there -
alt text http://www.beakersoft.co.uk/img/report_icons.gif
Any one seen this or know how to fix it?
This problem (wrong display of plus-minus tiny toggle icon) occurs when you want to initially set the Visibility as Show, in the Group Properties (bottom left pane, Row Groups, right click). The solution is to:
Click the text box where the toggle icon should appear
At the property pane, near the bottom, under the Visibility, set InitialToggleState to True
You can set the initial appearance of the toggle icon for the textbox properties (The textbox that controls the visibility of a row/group). You can find this setting under the Visibility tab of the textbox properties dialog box. Use an expression to determine the initial appearance of the icon for different toggle items.
See this short article for more info:
I was facing the same issue.
To resolve this issue Make InitialToggleState property of text box on which display is toggled conditional.
Like this
=iif(Parameters!DrillDown.Value,true,false)
And my show or hide is based on expression
=iif(Parameters!DrillDown.Value,false,true)

ms access 2003 - Text boxes on a form: not jumping to any text box

Ok so I add all these text boxes on an unbound form, and everytime you open a form, it sort of jumps to the first text box so you can enter some information into it.
How do I get rid of that, because I do not want it to auto jump to the first text box when the form opens...i do not want it to jump to any text box when the form open at all.
thanks
You will have to decide where you do want it to go, because it has to go somewhere. You can control where will tab order, set focus, and autotab.
I have just checked, and the best thing to do is to set the textboxes Enabled property to No and the Locked property to Yes.
The default behavior is of course for the cursor to move into the first control that you’ve set up in the tab order.
Assuming you still want some sensible tab order in the form, then place a zero length text box in the forms headder. Remove the tab stop setting (other tab in property sheet). You might as well set this box transparent also.
Then in the forms on-load event, simply go:
Me.NameOfTextBoxinFormsHedaing.SetFocus
If I read your question correctly it seems that you do not want any of your textboxes on the form to have the focus on opening the form.
What you need to do in this instance is to create a new unbound textbox on your form, and then make this unbound the first item in the form's tab order. Then resize the unbound textbox to 0 height and 0 width, making it invisible.

What's the best way to hide a tab in a TabNavigator?

I'd like to conditionally hide a tab in a TabNavigator. It seems that setting visible doesn't work properly (presumably because this is how the TabNavigator hides the tabs that aren't currently selected).
What's the right way to do this?
You can do this by making use of TabNavigator's getTabAt() method which returns the Button that makes up the visual tab. You can then set that Button's visible property. It's a little tricky to get this setup with a bindings, but it's doable.
You could also consider just disabling the tab instead, which you can do by setting enabled on the corresponding TabNavigator child (for which visible didn't work).
What do you mean by hide? If you actually mean remove, then just take your array that's bound to the data in the TabNavigator, and remove the applicable element from it.
If you want to just have them removed temporarily, create a component of your own that encapsulates the TabNavigator and has an array of removed tabs and an array of actual tabs. Then handle this as you see fit.
You might want to check out the flexlib project. They have a component called SuperTabNavigator that adds a lot of functionality to the base Flex TabNavigator, including hiding tabs (I think).
If you do have to create your own component, though, it's a bit more tricky. The thing to know is that "tabs" are actually specially styled buttons, contained within a TabBar component (the TabBar is then contained within the TabNavigator). What you'll have to do then, is subclass TabNavigator and have some property on your views (i.e. the canvases, etc. that are added to the TabNavigator) that is bound to the visible and includeInLayout properties of the TabBar buttons.
In essence, what you'll have is something like:
BindingUtils.bindProperty( tabButton, "visible", view, "someProperty" );
BindingUtils.bindProperty( tabButton, "includeInLayout", view, "someProperty" );
I don't know about TabNavigator, but in other containers, you can set the includeInLayout property to false and it will be ignored. You probably still need to combine it with visible.
var secondTab = tabNavigator.removeChildAt(0);