Monthly Archives: March 2013

My Software Project – Part 2

To expedite my progress, I had to switch to C#. The solution contains several C# projects and one C++ project a wrapper around native C++ SQLite code. Most code is now written in managed code. Doing that in C++ was just too painful. String manipulation, even in C++ 11, was not user friendly at all. I also found that most .NET libraries that deal with Web connectivity are same as before, while C++ does not have their clean WinRT equivalents. I was finding myself stepping down to navite C++ code base too often and did not feel comfort in that land. I really think it has to do with expected time-to-market.

I don’t want to go on a rant here, but C++ takes too long to code in. Do I use a ., a :: or a -> between my object and its method? Should I define this function inline in the .h file or should I implemented in the .cpp? After getting way too comfortable with developing managed C# code, C++ makes me feel completely unproductive. I spend way to much time thinking about properly coding, and that leaves too little time to think about how my app should work. Now, perhaps that’s because my C++ is weak. I don’t write in C++ too much, but should I?

Considering I am not writing a serious graphics app, nor a low-level device driver, nor a high-frequency trading app, why would I do it? It’s not fun at all!

Comments welcome.



March 31, 2013

This morning, I published my app to the Windows Store. The code is here:
As part of the submission process, I had to come up with a privacy policy. I found that a WordPress-hosted page is a good solution for this. So I borrowed a policy from and put it here: Hope Agustin Pretto does not mind too much.

Will document approval steps here.

Leafing Through News Articles on Your Tablet

I thought it would be neat to simulate a real newspaper experience in my news reader app running on a tablet. I decided to use the FlipView control to display the text of the article. The control allows users to use sliding gestures to move forwards and backwards. Slide left to move forward on the article list, and slide right to move backwards.

To make the experience more user-friendly, I thought that I would want to scroll the text all the way to the beginning every time the view changes from one article to the next. To achieve this, I found that I had to derive from the basic FlipView to gain access to the VisualTree of the NewsArticle. The ActionSelectedItemView method below can be called from the outside, providing a News Article, the method, in turn will call the provided delegate, passing the root of the Visual Tree as a parameter.

class CustomFlipView :FlipView
    public void ActionSelectedItemView(Action<DependencyObject> action)
        if (SelectedItem == null)

        var element = this.ItemContainerGenerator.ContainerFromItem(SelectedItem);
        if (element != null)

And this is how I use it: whenever item changes, my delegate gets called back with a visual root of the current SelectedItem, so I find the ScrollViewer and I scroll it to the top.

public sealed partial class LandscapeView : UserControl
   public LandscapeView()
      contentViewHolder.SelectionChanged += contentViewHolder_SelectionChanged;

   private void contentViewHolder_SelectionChanged(object sender, SelectionChangedEventArgs e)
      var fv = sender as CustomFlipView;
      fv.ActionSelectedItemView(dp =>
         var view = dp.GetFirstDescendantOfType();
         if (view != null)

Now, what about the flipping experience? Well, to do this I bound my FlipView ItemSource to the list of articles in the Selected RSS feed. I bound the SelectedItem property of the FlipView to the SelectedItem property of the Selected RSS Feed.

The Template used hold all items is a VirtualizingStackPanel with a Horizontal Orientation. Horizontal, because I want to flip from right to left, not from top to bottom. For a sample, go here: The VirtualizingStackPanel will create and cache up to 3 visuals at any given moment – one for the currently visible item, one for the previous and one for the next.

<local:CustomFlipView ItemsSource="{Binding SelectedFeed.FeedItems}" x:Name="contentViewHolder"  
  SelectedItem="{Binding SelectedFeed.SelectedItem, Mode=TwoWay}">
<VirtualizingStackPanel Orientation="Horizontal"/>
<ScrollViewer Style="{StaticResource VerticalScrollViewerStyle}" 
          FlowDirection="{Binding Path=Content.FlowDirection, RelativeSource={RelativeSource Self}}"
          x:Name="contentView" Content="{Binding FullText, Converter={StaticResource newsToXaml}}"/>

The converter will load the Visual, a properly formatted article text into the ScrollViewer, so every time users swipe from left to right, they navigate from article to article.