winrt-xaml

Throttling Events and Locking Methods

两盒软妹~` 提交于 2019-12-03 10:03:28
问题 Let's pretend I have something like this: <TextBox Text="{Binding Text, Mode=TwoWay}" /> And something like this: public class MyViewModel : INotifyPropertyChanged { public MyViewModel() { // run DoWork() when this.Text changes Observable.FromEventPattern<PropertyChangedEventArgs>(this, "PropertyChanged") .Where(x => x.EventArgs.PropertyName.Equals("Text")) .Subscribe(async x => await DoWork()); } private async Task DoWork() { await Task.Delay(this.Text.Length * 100); } public event

Choosing between XAML's ListView and GridView in WinRT

回眸只為那壹抹淺笑 提交于 2019-12-03 09:38:42
The GridView and the ListView in XAML seem to be the same control. How does a developer choose between the two? Jerry Nixon The GridView control typically scrolls horizontally. Also, you will see some native spacing between items that is greater than that in the ListView. This spacing is there because of the intent for how the controls will be used in Windows Store apps. (read on) Like the ListView it inherits from ItemsControl. Like the ListView groups using GroupStyle. Like the ListView it supports the two new Virtualization strategies. Like the ListView it supports the different Selection

How to detect two simultaneous touches?

巧了我就是萌 提交于 2019-12-03 08:19:27
Detecting touch in Windows Phone 8 leverages the System.Windows.Input.Touch.FrameReported event which is the most raw and certainly the most responsive touch event available to developers. You would use the event like this: public MainPage() { InitializeComponent(); // setup sounds Ellipse1.Tag = new Uri("Sounds/GVD_snr1.wav", UriKind.Relative); Ellipse2.Tag = new Uri("Sounds/GVD_snr2.wav", UriKind.Relative); Ellipse3.Tag = new Uri("Sounds/GVD_snr3.wav", UriKind.Relative); Ellipse4.Tag = new Uri("Sounds/GVD_snr4.wav", UriKind.Relative); Ellipse5.Tag = new Uri("Sounds/GVD_snr5.wav", UriKind

PreviewKeyDown for Windows Store App ListBox

做~自己de王妃 提交于 2019-12-03 08:05:43
Is there an equivalent to the PreviewKeyDown for a Windows Store App ? It isn't available. I have exactly the same problem as described here: I have a ListBox with a TextBox above it. I would like to use the arrow keys to navigate from the ListBox to the TextBox. The intention is that if the first item in the ListBox is selected, and the user keys up, the TextBox will get focus. Ah, tricky. Handling key events isn't super-obvious. Here's what you want: public MainPage() { this.InitializeComponent(); Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += (s, args) => { if ((args

ObservationCollection that implements ISupportIncrementalLoading within ViewModel inside PCL using MVVM architecture for WinRT & WP8/WinPRT support

折月煮酒 提交于 2019-12-03 04:42:05
I have my ViewModels inside a PCL, because I'm developing a Windows 8.1 and Windows Phone app in parallel. I have a list of things inside my ViewModel as an ObservableCollection. I have a GridView inside a Page inside a Windows 8.1 project. I wish to incrementally load items from my list of things in my ViewModel. Normally I would implement ISupportIncrementalLoading inside a custom subclass of ObservableCollection, however, given that my ViewModel is inside a PCL, ISupportIncrementalLoading is not available (it's not supported by WP8). So my question is, does anyone have any suggestions as to

Enabling ScrollViewer HorizontalSnapPoints with bindable collection

情到浓时终转凉″ 提交于 2019-12-03 03:15:27
I'm trying to create a similar experience as in the ScrollViewerSample from the Windows 8 SDK samples to be able to snap to the items inside a ScrollViewer when scrolling left and right. The implementation from the sample (which works) is like this: <ScrollViewer x:Name="scrollViewer" Width="480" Height="270" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" ZoomMode="Disabled" HorizontalSnapPointsType="Mandatory"> <StackPanel Orientation="Horizontal"> <Image Width="480" Height="270" AutomationProperties.Name="Image

Inspecting XAML in Windows 8 Store Apps / VS2012

一曲冷凌霜 提交于 2019-12-03 03:09:13
I'm looking for a way to inspect running XAML in a Windows 8 store app. Essentially, I want firebug / chrome inspector style functionality where I can look at the XAML source generated at runtime, to debug simple layout and style issues. I've tried Snoop, Pistachio and WPF Inspector but none work for Windows Store apps. The only one I can find which seems to work for Store apps is XAML Spy, which is €90. I can't justify that cost. Is there any other way to inspect running XAML? The VisualTreeDebugger class from WinRT XAML Toolkit is what you could use if you want a free tool. It doesn't do as

How to horizontally align AppBarButton in command bar

拜拜、爱过 提交于 2019-12-03 02:48:13
I want to align my single AppBarButton to the right on a CommandBar in a Page.BottomBar ? In design it shows the app bar button at the right side but in the emulator, the button is always at the center? Is there a way to align AppBarButton in a page bottom bar ? Edit: <Page.BottomAppBar> <CommandBar HorizontalAlignment="Right" HorizontalContentAlignment="Right"> <CommandBar.PrimaryCommands> <AppBarButton Margin="100,0,0,0" HorizontalAlignment="Right" HorizontalContentAlignment="Right" IsEnabled="True" Name="btnNext" Icon="Next" x:Uid="AppBarNext" Label="Next1"></AppBarButton> </CommandBar

Hiding the ellipsis within an AppBar

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 02:10:32
When you create an AppBar or a CommandBar in a UWP app, there's always an ellipsis hiding near the side of the control, like so: I don't want it in my app but I haven't found any methods/properties within AppBar that would help me get rid of it. It should be possible, because many of the default Windows 10 apps don't have it. For example, there's no ellipsis on the main menu bar below: Is it possible to hide the ellipsis using AppBar , or do I have to use a SplitView or some other control to implement this? Justin XL First, try not to use AppBar in your new UWP apps. The CommandBar control for

How do I grab frames from a video stream on Windows 8 modern apps?

十年热恋 提交于 2019-12-02 22:52:45
I am trying to extract images out of a mp4 video stream. After looking stuff up, it seems like the proper way of doing that is using Media Foundations in C++ and open the frame/read stuff out of it. There's very little by way of documentation and samples, but after some digging, it seems like some people have had success in doing this by reading frames into a texture and copying the content of that texture to a memory-readable texture (I am not even sure if I am using the correct terms here). Trying what I found though gives me errors and I am probably doing a bunch of stuff wrong. Here's a