Silverlight: Grid Control – Hide Row or Column


It seems like there is quite a bit of confusion about how to go about hiding a row or a column in the Grid control. Take the Grid control as defined below with two rows:

<Grid Name="grid" Height="100" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="200">
    <Grid.RowDefinitions>
         <RowDefinition></RowDefinition>
         <RowDefinition></RowDefinition>
     </Grid.RowDefinitions>
</Grid>

If you want to hide the first row, simply do the following:

// Hide the first row
this.grid.RowDefinitions[0].Height = new GridLength(0);

The same thing can be done to hide columns except instead of accessing the RowDefinitions collection, access the ColumnDefinitions collection.

Windows Gadget: WordPress Statistics Updated


WordPress recently updated the statistical charts and I got a request from a user to update the WordPress Stats Windows Gadget to reflect the changes as well. I have released a new version of the Windows Gadget here which includes the following changes.

Column Chart

The option of selecting either a line or a column graph as pictured above.

Updated Tooltip

The tooltip that appears when hovering over a data point is much more aesthetically pleasing and allows you to include the published posts when viewing the statistics grouped by day.

Windows Gadget: WordPress Statistics


I just wanted to mention that I released an updated version of my WordPress Stats Windows gadget. This release fixes a small inconvenience that occurs when waking the computer up from sleep or hibernation. On such an event a message box appears indicating that there is no internet connection. The problem occurs because a request is sent directly to WordPress.com when the computer wakes up before an internet connection can be established. The gadget will now not show an error message until two consecutive request fail due to a lack of internet connection.

The gadget can be downloaded here.

Windows Gadget: WordPress Statistics


For those of you who don’t like to read, this Windows Gadget can be downloaded from CodePlex here.

I have never actually used a Windows Gadget as I’m kind of a neat freak when it comes to my desktop. But, a couple of weeks ago I actually thought of a gadget that I would actually use: a WordPress gadget that allowed me to see view statistics of my blog as well as provide a few shortcuts to help administer my blog. I searched the internet and found one that has been developed that provides links to various actions on your blog here, but it didn’t provide any statistical information. So, I decided to create my own gadget.

For those who aren’t familiar with the development of a Windows Gadget, it is simply a set of web pages. When I discovered this, my first question was whether or not I could use Silverlight to develop my gadget and it turns out you can! I found a Visual Studio Project template created by Ioan Lazarciuc here that does all the setup and configuration for you. It is a great starting point and allows you to get right to the development instead of having to waste time figuring out which javascript methods have to called when, what the required markup is for the html pages, etc.

Here is a run through of the gadget:

Out of the Box – When you startup the gadget for the first time you will notice the “Configuration required” text at the bottom. Before you can view your stats and manage you blog you need to enter your blog information. Click on the wrench to open the gadget settings.

Settings – To use this gadget it must know two things: your blog uri, and your blog API key. The API key is like a password provided to you by WordPress and allows programs like this Windows Gadget to access statistical information. You can find it by logging into your WordPress account and clicking Users -> Personal Settings on the left hand navigation bar. At the top of the page you will see your API key. Copy and paste that into the Blog API Key text box.

Alternatively, you can enter your blog uri and click the Show Me link and a web browser will be opened directly to the page containing your API key.

Statistics – After you define the gadget settings and you click OK, the statistics for you blog will be loaded and you should see a line graph like the one pictured above.

Menu Options – If you click the arrow on the bottom right corner of the gadget you will see various menu items that will allow you to administer your blog. If you double click on any of them, you will be taken directly to the corresponding page.

Since this gadget was written with the Silverlight 4 Framework, you must have Silverlight installed on your machine for it to run. If you don’t have it installed, you will see the following image appear when you place the gadget on your desktop. If you click on the image, Silverlight will be downloaded and installed.

64-bit Users: If you have a 64-bit system, this image will appear even if you have Silverlight installed. The problem is that there is no 64-bit Silverlight Framework (just as there is no 64-bit version of Flash) but there is a 64-bit Windows Sidebar application which is started by default if you have a 64-bit system. Thus, if you want to run this gadget, you will need to have the 32-bit version of the Windows Sidebar application startup when Windows starts. John McClelland has posted instructions here on how to solve this problem (it says it is for Windows Vista but it works on Windows 7 as well).

This Windows Gadget can be downloaded here and the source code is available here. I consider this project still in beta but I currently use it every day and it appears stable enough for release. Let me know if you run into any issues by posting to the Issue Tracker on CodePlex.

Resources – I built this Silverlight based Windows Gadget using the following tools

Follow

Get every new post delivered to your Inbox.

Join 69 other followers