Adding a search contract to the Windows 8 Calibre frontend

In this post I will show how simple it is to add a search contract to a Windows 8 Store app. This contract allows the user to search within your application from anywhere in Windows 8 using the search charm.  We will use my Calibre frontend app to show this. Check this video to see the raw action of what we are making.

What we are building: the search in action after querying for books with "brown" in the authorname.

What we are building: the search in action after querying for books with “brown” in the authorname.

This is the second post of my quest on writing a Windows 8 Store app for Calibre. The previous post can be found here. Read more of this post

Writing a Calibre frontend for Windows8/WinRT using ‘SQLite for WinRT’

While developing a Windows Store frontend application for the Calibre ebookmanager, I’m hitting several bumps along the road. In this post I’ll explain some of the bumps and how I’ve tried to tackle them.

Basically they can be summarized as follows:

  • How to access a Sqlite database in a WinRT application
  • Circumvent file access limitation of SQLIte for WinRT
  • Load cover files of each book
  • Create incremental-loading Gridview using ISupportIncrementalLoading

Calibre is a great open source and free to use ebookmanager. It allows me to manage my ever-growing ebook-library and it supports lots of ebook-filetypes, including the ability to convert between the types.

My goal is to write a simple Windows Store application that acts as a frontend for the Calibre database. It will show my library in a visual appealing manner (aka TDPFAM, “The-design-principle-formerly-known-as-Metro”) and allow the user to rapidly query his database from anywhere in windows. At least that’s the idea. We’ll see where we end up (check here for a little video demonstrating the application I’m building).

Future follow ups on this project might be found here on the Calibre developer forum.

Early alpha of Calibre frontend, simply demonstration what can be done (check out the youtube movie). Note the layout that is based on one of the existing VS2012 WinRT project setup.

The original Calibre program

With this post I hope others get triggered to create their own Calibre frontend, because, knowing myself, I’ll get bored of the project pretty soon once I have to tackle the UI/UX stuff …which I don’t like.
Read more of this post

A WP7 databound graph control

For a project we are working on, we needed a simple (and free) WP7 graph usercontrol. The data which the usercontrol visualizes needs to be databound and each time new data arrives, the graph should update itself on-the-fly .In the following tutorial we’ll show how to create such a control from scratch (make note that normally this should also work in Silverlight or WPF projects).

A demo-solution of this tutorial can be downloaded here.

Read more of this post

Creating an Intellisense compatible enum-based Dependency Property

Actually, this post has a way too fancy title , because in fact I will merely show that enum-based dependency properties are IntelliSense compatible “out-of-the-box”. (by the way, if you know all about dependcy properties: simply read the line in bold and you’ll know all there is to know).

When creating a (WP7/SL/WPF) usercontrol, one often ends up creating one more dependency properties (DP). Most of the times you only want a discrete set of possible values that can be assigned to the DP. The logical choice then of course is to have an enum-based DP.

Now, for the Intellisense to work it is important that you define the enum type OUTSIDE the usercontrols class. For example, suppose we have define the following enum:

public enum GraphTypes {Default, Point, Line}

Now, all that remains is to add a DP that uses this enum (remember that you can use the ‘dependencyproperty’ snippet that comes with VS):

        public static readonly DependencyProperty GraphTypeProperty =
            DependencyProperty.Register("GraphType", typeof (GraphTypes), typeof (GraphControl), new PropertyMetadata(GraphTypes.Default));

        public GraphTypes GraphType
        {
            get { return (GraphTypes) GetValue(GraphTypeProperty); }
            set { SetValue(GraphTypeProperty, value); }
        }

Once you now add the usercontrol elsewhere in your xaml-code, IntelliSense will happily show what values can be assigned to the DP:

There we go. That’s all there was too it.

Next post I’ll show how to create a WP7 user control to plot graphs using data binding. Consider some of the code here a sneak preview.

Using delegates, func and lambdas: a tutorial with soldiers

In this tutorial, written for beginning programmers, I’d like to show a little demonstration on the usage of delegates and how we can go all crazy by refactoring and magically see all our duplicate code disappear.

Imagine we are writing the next ultimate Command&Conquer spinoff which can run on any computer …in console-mode. Read more of this post

Writing a WP7 website scraper application

In this tutorial I will explain how you write a WP7 application using the HtmlAgility Pack in order to use information scraped from a website.
Website scraping is the act of retrieving information from a website page. An act by some considered stealing, by others borrowing. Let’s leave that debate to the others. In this post I will show how easy it is to scrape content from a website so that you can (re)use it in your Windows Phone 7 application. As it is, this information will for the most part also work in other, non WP7, projects of course.
Sometimes website scraping is the only means available to consume certain information from a website. If the website doesn’t have some publicly available API or web service you can use you’re pretty much left with scraping, whether you like it or not.

Read more of this post

7 WP7 dev tools you might not know but will want to have

There’s an incredible amount of guides, tools and utilities to be found on the Internet (or should I say ‘tha cloud’?) for Windows Phone 7 developers. Compiled in this article are some of the tools I’ve come across on my searches which I now use frequently but didn’t know the existence of beforehand. Read on to change you WP7 development life. Read more of this post

Learning to cook with WP 7.5 data (a book review)

Recently I received a review copy of the “Windows Phone 7.5 Data Cookbook” by Ramesh Thalli from Packt Publishing (ISBN 978-1-84969-122-2). This book, divided in 8 chapters, shows how simple it is to write data-driven programs WP7 applications.


What follows is an extensive review of this book.
Read more of this post

New WP 7.5 ebook review copy arrived

I just received a review copy of a soon to be published book, titled “Windows Phone 7.5 Data Cookbook” by Ramesh Thalli from Packt Publishers. I will put up a review of it soon. However, I can already hint, after quickly flicking through the pages, that many who liked its unofficial predecessor “Silverlight 4 Data Services Cookbook” by Gill Cleeren and Kevi Dockx will also like this one a lot. If you can’t wait for my review, check out a sample chapter (chapter 2 on using Isolated Storage for data storage) here.

Creating a WP7 app: Listbox items of the same width

I love databound listboxes in WP7. I do. I really do. However, every time I come to the part of making a nice template for each item (i.e. shiny ugly orange border, etc.) I fail in having items of equal size. This is usally what I produce:

Resulting in:

In WPF, the trick is to set the HorizontalAlignment=”Stretch” property of the Listbox. However, apparently there still some internal bug in the ListBox control, which results in the ListBox simply ingoring that setting.

The solution however is, luckily, provided by Microsoft’s Peter Torr in a reply in here.

By simply adding the ItemContainerStyle as described in the post , to the ListBox we get the result we are looking for:

Resulting in ..hooray:

Update: As Alex Sorokoletov was so kindly to cmment (thanks for that), there’s even a simplier solution:

<ListBox.ItemContainerStyle>
<Style TargetType=”ListBoxItem”>

<Setter Property=”HorizontalAlignment” Value=”Stretch” />
<Setter Property=”HorizontalContentAlignment” Value=”Stretch”/>

</Style>
</ListBox.ItemContainerStyle>

Follow

Get every new post delivered to your Inbox.

Join 327 other followers