How can I expand my longListSelector item when clicked? - windows-phone-8

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.

Related

How to show droppable area using Drag and Drop HTML API

I'm implementing a functionality where the user can sort the list and re-order the elements, on dragover I want to show the droppable area below the dragover element.
Note: I want to achieve this using native javascript
Without seeing your code I can't suggest an exact implementation but you can use JS to inject a "placeholder" element.
First, you'll need to know the position of all your items, maybe use an array to log the order of your list items.
Next, on dragover append the placeholder element in the place of where the dragged item you are moving is located on the list. For example, if you have a list like:
ITEM 1
ITEM 2
ITEM 3
ITEM 4
When you drag ITEM 4 over ITEM 3 then inject the placeholder after ITEM 2 so it appears between ITEM 2 and 3. When you drop ITEM 3, you can remove the placeholder.
Note, you'll also have to remove the injected placeholder as you move further up/down the list. Otherwise, you'll end up with multiple placeholders.
There are also plugins available for this such as HTML5 Sortable and SortableJS

Set new focused item in a List Box

I have a question. Is it true that in Access 2010 we can read which item in a list box has Focus. By focus I mean that little rectangle that is around current item. This is not a selected item. Selected item is highlighted. By clicking on List Box we set focus on an item and also select it. When selection is changed the focus stays there.
The property that indicates the index of that item is I believe .ListIndex. I would like to programmatically change it but unfortunately .ListIndex is read-only in Access 2010. Is there any other way I can do it?
Thanks

Show/hide stack panel child elements

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.

Toggle table visibility w/ click

I have a ssrs simple table with a text box above it.
I want to add an image with an expand collapse option, and initially when the report is show hide the table, and when the image is clicked show and continue to toggle everytime it is clicked.
For example:
Initially:
After Click:
The image name is expand_collapse, the table name is error_table. I know I need to right an expression for the visibility properties of error_table, I have not found anything with a click.
You can do it by checking the toggle display box:
Set the name of the text box containing your Error(8) statistics from the dropdown.
This creates a little +/- box that looks like this when collapsed:
And like this: when uncollapsed.
The "When the report is initially run" option sets the state when the report is first run, so if you want it to be collapse to start, select "Hide" as I've done above.

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.