Getting rid of the Start button in Windows 8.1

Sunday, September 15, 2013

Windows 8.1 brings back the famous Start button, but alas – it’s not the good Start button from Windows 7. It’s just yet another way to get to the new Home screen. This makes the Start button (at least for me) completely useless, as there are already several ways to get to the Home screen (Windows key on the keyboard, mouse moved to the bottom left corner, touch devices can press the hardware Start button, the Charms bar has a Start button…).There are utilities that can simulate the old Windows 7 Start button, if I don’t have such a...

Making HTTP calls in WinRT with C++

Monday, January 14, 2013

When working with Windows Store applications (“metro”), it’s sometimes necessary to make HTTP calls. one classic example is to register for push notifications. After obtaining a unique channel URI, the app needs to send that URI to its application server, as that particular URI is the one to use by the application server to execute a push notification against the Windows Notification Service (WNS).Getting the channel URI is fairly simple, with a call to the static PushNotificationChannelManager::CreatePushNotificationChannelForApplicationAsync method. Now comes the tricky part: how to send the resulting URI to the application server?In .NET, things are relatively easy. Just use...

WPF/Silverlight Tip: Transparent Hit Testing

Thursday, February 23, 2012

Hit testing is the process of finding out which elements (if any) contain a certain point (typically the location of the mouse pointer). Sometimes, however, there is a need to disregard some elements in a hit testing scenario. Consider this simple program that allows moving of circles: One can grab a circle and drag it around. Here’s the MouseLeftButtonDown event handler on the containing Canvas: void OnMouseDown(object sender, MouseButtonEventArgs e) {     var shape = e.Source as Shape;     if(shape != null) {         _canvas.CaptureMouse();         _moving = true;         _current = e.GetPosition(_canvas);         _currentShape = (FrameworkElement)shape.Parent;     } } ...
no comments

WPF Tip: Binding to the Selected Item in a Master-Details View

Tuesday, December 6, 2011

Master-details is a common way to display data. A master view provides minimal data for a collection of objects (e.g. book names), and when selecting one such item, a details view provides more information for the selected item (e.g. a book’s name, author, publication date, etc.). In WPF, data binding (in XAML) is typically used to achieve the connection between an object and its details without using any code. Let’s see how we can achieve this. Let’s say we want to show a list of book names, and when a book is selected, we want to show...
tags: , , , ,
no comments

WPF Tip: SharedSizeGroup

Saturday, November 26, 2011

Suppose we want to display a set of objects in a ListBox (or other ItemsControl) using a DataTemplate that uses a Grid: <ListBox HorizontalContentAlignment="Stretch" x:Name="_list" >     <ListBox.ItemTemplate>         <DataTemplate>             <Border Margin="2" BorderBrush="Blue" BorderThickness="2" Padding="2">                 <Grid>                     <Grid.ColumnDefinitions>                         <ColumnDefinition Width="Auto" />                         <ColumnDefinition />                     </Grid.ColumnDefinitions>                     <TextBlock Text="{Binding Name}" FontSize="20" Margin="4" FontWeight="Bold" VerticalAlignment="Center"/>                     <TextBlock Text="{Binding Author}" FontSize="16" Grid.Column="1" VerticalAlignment="Center" Margin="10,4,4,4" />                 </Grid>             </Border>         </DataTemplate>     </ListBox.ItemTemplate> </ListBox> Running this sample with some of my favorite books, yields the following: Note the lack of alignment. How can we fix this? One...
tags: , , , ,
no comments

Reminder: WPDUG September Meeting

Sunday, September 4, 2011

This Wednesday (the 7th) will hold a Windows Platform Developer User Group meeting in Microsoft’s offices in Ra’anana (Israel). Our first session will be about adding realtime and deterministic capabilities to Windows and its impact on the system and the ways to program such a system (all based on addons by a company called TenAsys). The second session will demonstrate useful (and undocumented) debugging tips and tricks in Visual Studio (primarily for native developers). Should be interesting for all you Visual C++ developers, and others interested in low level coding. Use this link to...

WPF Tip: Using a MouseDoubleClick event where none exists

Wednesday, August 3, 2011

Consider the following simple piece of XAML:        <Border Margin="10" BorderBrush="Black" BorderThickness="2">             <Grid Margin="4">                 <Rectangle Fill="Red" />                 <TextBlock Text="Hello" FontSize="15" />             </Grid>         </Border> Now suppose we want to handle a double click event of that border element...
tags: , , , ,
2 comments