Windows Store App: Should I use ListBox or ListView? - windows-8

I have a question about Windows Store Apps:
what is the difference between the:
ListBox
ListView
i want to have a list with different TextBlocks

The more Windows-8 App style control is the ListView. It has built-in functionality for things like scrolling. The ListBox does basically the same things except it doesn't have the nice scrolling functionality.
See here for a more in-depth treatment.

Related

TabControl without header in Avalonia UI

I would like to create a simple wizard based on a TabControl in Avalonia UI with four pages. Each page with a few controls. Instead of the TabItem headers I would like to create my own buttons and hide the default TabItem headers.
There are plenty of solutions for WPF, mostly involving ItemsContainerStyle and the Visibility property, both of which don't seem to be accessible in the Avalonia TabControle.
Is there any way to hide the headers?
Or is there a better way to implement a wizard?
You probably need to use the Carousel class directly. It's used by the TabControl internally for presenting the current item.
See example usage here:
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/CarouselPage.xaml - markup
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/CarouselPage.xaml.cs - codebehind

UWP Menu XAML Controls

I am trying to implement a layout like the one in the MSN News app on my app for Windows 10
I want to replicate a menu like the one that says "All, Top Stories, US" and such. I have tried ListBox, AppBar and CommandBar and nothing seems to resemble this layout. Which controller should I use?
Check out the Pivot control. You can find out what elements any UWP XAML apps are made of by debugging them with VS and using the Live Visual Tree view.

Detect end of GridView / ListView in Windows Store 8.1 App

Both GridView and ListView have a nice "bounce-effect" when you try to scroll beyond the begin or end.
Some applications (on other platforms) use this "drag-beyond-end" gesture as a trigger for some actions, like loading more items.
How can I detect this "state" (=user is at the begin/end and tries to scroll beyond that) in Windows Store App using XAML/C# ?
The rubber-band effect cannot be detected by code in a Windows 8 app (verified with the XAML controls team).
One way you could do that would be by handling all the inputs and the rubber-band effect yourself, but that is a bit of work, it reduces scrolling performance and requires manual handling of input on any list elements as well, so I would only recommend it as a last resort.
Also note the problem of the mouse input scenario since mouse scrolling doesn't involve this pull-beyond-edge behavior.
If you just want to load more items when you reach the end of the GridView, implement the ISupportIncrementalLoading interface with your collection derived from ObservableCollection<T>. See the answer here Load more items on grid view scroll end.

C#/XAML Store App: accessing controls in FlipView.ItemTemplate

I've got a Flipview which has an ItemTemplate which contains a MediaElement and buttons for pause and play. I need to be able to access the MediaElement based on the Clicked event on the buttons. What is the best way to link my buttons to my MediaElement? Most of the code examples I find on the internet apply to WPF and not Store Apps. Ideally, I'd like to be able to use CommandParameters or some other type of XAML binding to pass the MediaElement control back to the event handler. Thanks
Put your MediaElement and buttons in a separate UserControl and put that control in your ItemTemplate. After that - it should be easy.

UserControl vs LayoutAwarePage (Windows 8 XAML)

What is the difference between <common:LayoutAwarePage and <UserControl... in XAML in Windows 8. Looks like both are used as W8 pages.
A Page is what you need to use inside of a Frame to support the standard navigation framework and the standard AppBar class. LayoutAwarePage adds support for different visual states depending on layout (portrait, landscape full/filled/snapped), which really is required when you are building an app to submit to the store.
A UserControl is just a simple way to group some UI pieces and code-behind together useful especially if you want to have a reusable piece of UI that shows up on different pages or if your page design becomes too complicated (eg. if you have a lot of XAML for different page layouts). It is also useful if you want to create a common control to be reused in multiple places or multiple projects, but don't care about being able to restyle it - then you would need to create a custom/templated control.
layoutawarepage are page that allow supports for the various view such as filled, snapped, portrait and landscape. in which you would have to handle the visualstatemanager in xaml and do the switching from various view in codebehind.
while usercontrol are elements that you can place in other pages.