Unable to add longlistselector tool - c#

I am working on a windows phone project, under a universal project. A feature I am looking for is the longlistselector template, that I am unable to find under toolbox. Am I missing something?
Or rather, if there is a way to arrange a list (of say countries), and lets say alphabetically, I wouldn't mind using that either.
VS2013 - U4; W8.1;
Thanks in advance!

There is no LongListSelector in WP8.1 RunTime/Universal app. Take a look at available controls at MSDN.
If you need a simple list, take a look at ListView.
If you need grouping, then think of using SemanticZoom. In this case you will find also some help here at blog, here or here.

LongListSelector is not available for Universal apps, it's only available for Silverlight Phone apps. Instead you can use ListView .
Example :
<phone:LongListSelector ItemsSource="{Binding Items}" >
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}">
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" >
</DataTemplate>
</ListView.ItemTemplate>
More details check this article : Migrating from the LongListSelector to the ListView in Windows Phone XAML Apps

Related

Get parallax on ListView Xamarin

I'm new to Xamarin and C#.
I'm making an app with a ListView. Therefore I want to add a settings section where to can specify your search.
I want it to be like above the ListView as header and with the effect that when you scroll down the ListView the section gets smaller. I googled and found something called parallax effect and found a nuget package called DevsDNA.XFParallax.
Can I use this for ListViews, too? And is this the way you should do this? Or is there a better way of handle such things?
You can set the Header of listview .
<ListView x:Name="GroupedView"
GroupDisplayBinding="{Binding Title}"
GroupShortNameBinding="{Binding ShortName}"
IsGroupingEnabled="true">
<ListView.ItemTemplate>
<DataTemplate>
// ...
</DataTemplate>
</ListView.ItemTemplate>
<!-- Group Header Customization-->
<ListView.GroupHeaderTemplate>
<DataTemplate>
// set the layout of header here
</DataTemplate>
</ListView.GroupHeaderTemplate>
</ListView>

Any similar "ListView" UI Control in Xamarin.Mac?

I'm planning to design an multiple file downloader app (similar to IDM or Transmission) for macOS based on Aria2 JSON-RPC and C# GUI via Xamarin.Mac. But there is a major issue for UI design. I need a UI control which is similar to "ListView" in XAML.
Basically it's something like in this topic discussed, i.e. I need something equivalent in Xamarin.Mac with this XAML code below:
<ListView x:Name="DownloadItemList">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding DownloadItemTitle}"
Margin="20,0,20,8"
FontSize="24"
FontStyle="Italic"
FontWeight="SemiBold"
Foreground="DarkBlue" />
<TextBlock Text="{Binding DownloadProgressInfo}"
Margin="20,0,20,8"
FontSize="16"
Foreground="DarkGray"
Opacity="0.8" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
I also need some data bindings in the UI code if possible. But so far I can't find any similar stuff in Xamarin.Mac. Is there any possible solution like this? Thanks in advance!
You can use NSTableView
static Content :
You can design cells from storyboard, and if required can modify content of these cells at runtime.
Dynamic Content : You can crate template cell at design time (or progrmmatically id requried ), give it identifier and use that cell multiple-time in tableviewd atasource.
You can use something like a table view
Hope this helps.
Link

How to UWP Print ListView ItemTemplate

I'm trying to figure out how to print a ListView ItemTemplate using the uwp PrintHelper.cs sample. Everything works, except the print preview does not display items added to the ListView at runtime. I can add other controls such as a textbox, and the print preview will show it, so there must be something peculiar with printing databound ListView items at runtime, but I cannot find any information about it.
<ListView x:Name="ClipboardList"
xmlns:m="using:QuickieEdit.Models"
ItemsSource="{x:Bind ViewModel.MemoryItems}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="m:MemoryItem">
<StackPanel Orientation="Horizontal">
<Button x:Name="MemoryCopyBtn"
Content="Copy"
Click="How to Copy currently selected
MemoryListItem.Text?"/>
<TextBox x:Name="MemoryListItem"
Text="{x:Bind Memory, Mode=TwoWay}">
</TextBox>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
I cannot understand your exact query, but I think you may be facing situation where your ListView does not get updated with the model and hence does not show up while printing. You can use
ObservableCollection<Model> instead of List<Model>
This will solve your problem or if it does not please provide the c# code in detail as well
Cheers

panorama controls windows phone 8.1

I 'm developping a windows phone 8.1 application and I would like to make a view with the panorama control but Its impossible to find the control
I have the Pivot control but not the panorama, is the panorama control is available on windows phone 8.1 ?
I have find nothing on it on the Internet so far :/
Thanks for the help :)
The Panorama control has been renamed Hub because it’s now available on both Windows Phone and on Windows. So, you would do something like:
<Hub Header="My header">
<HubSection Header="My sub header">
<DataTemplate>
<Grid />
</DataTemplate>
</HubSection>
<HubSection Header="My sub header 2">
<DataTemplate>
<Grid />
</DataTemplate>
</HubSection>
There are some changes in the API, as you will use HubSection instead of a PanoramaItem, and you must have a DataTemplate inside a HubSection, so be sure to check the following reference:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.hub.aspx
There are some nuances as a slightly different and odd behaviour when you have only 2 HubSections, as noted here: Windows Phone 8.1 app with 2 hub sections, but that may or may not be an issue for you. Some guidelines and implementation examples can be found here:
https://msdn.microsoft.com/en-us/library/windows/apps/dn449149.aspx

How to add rows to gridview dynamically in windows phone 7.1 application?

in my window phone 7.1 application(silverlight application, c# language using VS 2010 express for windows phone) i created gridview to show my data(search results) in table format. I created a class and bound that gridview to that class succussfully. this is my xaml code:
<phone:PhoneApplicationPage.Resources>
<local:searchResultItemModel x:Key="searchResultIM"/>
</phone:PhoneApplicationPage.Resources>
<gridView:GridView x:Name="GridView1" CellSpacing="1" RowSpacing="1" SelectedItemChanged="GridViewSelectedItemChanged" Margin="26,16,25,22" ItemsSource="{Binding Source={StaticResource searchResultIM}, Path=Data}">
But i want to add rows dynamically. As this is static i cant able to add rows to it. Is anyother way to add rows dynamically. Could anybody help me please?
You have to use the ListBox Control and template it to your liking. The ListBox also includes bunch of features like UIVitualization that will help with bigger sets of data.
As said you can use the ListBox with a datatemplate to control the look of each row. Example:
<ListBox ItemsSource="{Binding Source={StaticResource searchResultIM}, Path=Data}" ItemTemplate="{StaticResource SearchItemTemplate}" />
Put the above ListBox element inside your LayoutRoot (usually a Grid control) in your Phone page. In the ListBox you will refer to the ItemTemplate to use (defined as DataTemplate) which you define in your resources section, example:
<DataTemplate x:Name="SearchItemTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding YourDataProperty1}" />
<TextBlock Text="{Binding YourDataProperty2}" Grid.Column="1" />
</Grid>
</DataTemplate>
The datacontext for the template will be the type of object you get in your results. So YourDataProperty1 etc could be a property on that resultobject.
Hope it helps!
/Anders
Building a DataGrid Control for Silverlight for Windows Phone
http://www.silverlightshow.net/items/Building-a-DataGrid-Control-for-Silverlight-for-Windows-Phone-Part-1.aspx
This suits the way to create a dynamic table perfectly, The problem in using list box is if the contents goes beyind windows phone, its not easy then to create table using listbox. This grid control has lot of features that would help a newbie like me. Its totally intuitive

Categories