Styling a LongListSelector in Windows Phone apps - c#

How do I style a LongListSelector to look like below?
I have tried styling it as you would normally style a ListView in a XAML (Windows Store) app or Desktop app but obviously it's different so it didn't work. I have also spent a while searching but I have never seen anything like this for a LongListSelector. But there are no other types of lists.

i think u are looking for WrapPanel
more info at http://www.geekchamp.com/articles/wp7-wrappanel-in-depth

I got it.
You need to add LayoutMode="Grid" and GridCellSize="75, 75":
<phone:LongListSelector LayoutMode="Grid" GridCellSize="170, 150"/>

Related

How to display button over a Ad Mediator in windows phone 8?

I use in the application Ad Mediator. I need to add a button(see example)
I tried to use the Canvas and Canvas.Zindex. But then does not display advertising. Please tell me how to do it.
Just embed it in a panel like Grid so it just follows the DOM. Something like (in pseudo);
<Grid>
<AdMediator/>
<Button/>
</Grid>

Windows Phone 8 Font Binding

I'm really stumped on how to go about binding fonts to a textbox. I'd like for my user to be able to choose between 3-4 different fonts. I have something like this right now:
<TextBox x:Name="MyTextBox" AcceptsReturn="True" FontSize="20"
FontFamily="{Binding FontSelection}" />
But I have no clue how the c# should look, and I had no luck googling for it. What is the best way to do this? Do I have to create an observable collection? I've tried adding fonts to the Application.Resources, but it wouldn't let me.
Thanks for any answers!
This FontSelection property has to be single item. You could first try simple valid string (like 'Arial'), it could work. Another approach is FontFamily type as poined out by Romasz.
Also there are Converters available, quite easy to implement. http://channel9.msdn.com/Series/Windows-Phone-8-1-Development-for-Absolute-Beginners/Part-25-Advanced-Binding-with-Value-Converters With this you could save user font selection as simple number for example and convert it to appropriate type with Converter.

Search Box Control in windows phone 8

Can anybody tell me how do i add search-box control in "XAML" windows phone 8?
i have tried for search-box control but seems that there is no such control exist.No such Namespace exist error shown by compiler..please suggest any answer thank you in advance.
You could use AutoCompleteBox which is a control works like a searchBox
<toolkit:AutoCompleteBox x:Name="txtSearch" ItemsSource="{Binding}" Margin="0,22,3,10" />

WPF ListView items drawn

I have Listview with templated items (which looked just like Windows Explorer). My problem is when I openning folder which contains a whole lot of files that ListView loads those files not smoothly.(see video: http://screencast.com/t/bY7ucELj9I).
Does someone has any idea how to solve it?
You may need to virtualize your ListView's Items. Example
<ListView Name="ListViewWithVirtualization" Height="100" Margin="5"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling" />
If you set VirtualizingStackPanel.VirtualizationMode = “Recycling” then each container will get reuse instead of destroy. You will get better performance by specifying VirtualizationMode to Recycling than basic default virtualization. See http://msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingstackpanel.aspx

How do I make clickable text

I have been trying to create buttons on Windows Phone 8, which don't look like buttons, but just look like text, however, I haven't been able to find this question answered anywhere else. I am trying to create something like what Microsoft have used below for the camera roll, albums and date buttons below. Is anybody able to explain how I can do this, or maybe link me to a tutorial or something that I may have missed while searching? Thank you.
Windows phone uses XAML code to create UIElements. Very similar to WPF, you can use almost any UIElement as a button. This is because each element has a large amount of events that can be tracked. Think of it as a layered cake. If you have a textblock inside of a listbox inside of a grid, similar to what you see above. Then when someone clicks on the textblock it will try to handle the event. If it isn't set to handle it then the listbox tries. If the listbox cant then the grid tries and so on. What you are looking for is the tap event in the textblock. Google textblock tap event.
<Grid x:Name="LayoutRoot" Background="Transparent">
<ListBox>
<StackPanel>
<TextBlock Tap="title_Tap_1" Name="title">title</TextBlock>
private void title_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
{
//Your code here
}
I tend to use a ListBoxItem to wrap a TextBlock. It allows you to use the TiltEffect from the wpToolkit to show interaction and also exposes a Tap event for the ListBoxItem
<ListBoxItem toolkit:TiltEffect.IsTiltEnabled="True" Tap="On_Tap">
<TextBlock>Hello World</TextBlock>
</ListBoxItem>
I don't know for Windows Phone 8 because I haven't written any app yet. I think that this is like Windows Phone 7 , 7.1 that I used to write code. This control that you see is a ListBox and inside there are ListBoxItems. ListBoxItem can be anything (it can be used as a container to insert anything inside it.). Hope it helps.
The easiest way is to use HyperlinkButton instead of classic Button. In that print screen I doubt there's a list for only like... 3 buttons (hyperlinkbuttons).
Controls in the xaml world are look-less: use a button in your ItemTemplate and turn the border off. Then you can use the command property of the button for binding to your VM, or if you are not using MVVM use the Click event of the button and handle it in the code behind.

Categories