This one took me a bit to figure out.

There were many times where I wanted to bind an element’s property to another’s, but slightly modified. For example:

<Grid x:Name=theGrid>
    <ComboBox x:Name="cbThird"
              Width="{Binding ElementName=theGrid, Path=ActualWidth * 1/3 + 200}"
               />
.
.

The above code snippet is trying to declare that the ComboBox’s width is a third of the grid’s plus an additional 200. Of course, you can’t do this as shown above, and Cider will be quick to catch your foolhardiness. It would appear that your only options would be to do this through the code behind; that would be unfortunate, as you’d have to handle resize events and all that muckery.

Luckily, you can acheive the same effect in pure XAML by making use of Transforms. Below is an example of how you would define the ComboBox’s width to be 1/3 of the grid that it is contained in plus an additional 200.

<Grid x:Name="theGrid">
    <FrameworkElement x:Name="gridTransform" Visibility="Collapsed">
       <FrameworkElement.RenderTransform>
         <TransformGroup x:Name="transformGroup">
          <TranslateTransform X="{Binding ElementName=gridConnect, Path=ActualWidth}"/>
          <ScaleTransform ScaleX="0.33"/>
          <TranslateTransform X="200"/>
         </TransformGroup>
       </FrameworkElement.RenderTransform>
    </FrameworkElement>
    <ComboBox x:Name="cbThird"
        Width="{Binding ElementName=gridTransform, Path=RenderTransform.Value.OffsetX}"
        />

Adjusting the ScaleX attribute will change the width’s multiplicand, while adjusting the X attribute (in the TranslateTransform tag) will adjust the width we’re adding to the result of the multiplication.

 

Due to loss of old server, code is not available. Previous links are stripped until then.

A new library by the name of Omniscientist.Cloud.SqlServices.Linq has been created to be used in conjunction with the Omniscientist.Cloud.SqlServices library to allow the use of LINQ expressions with SQL Data Services entities. Basically a LINQ to Azure.

The SqlServices.Linq library provides implementations of IQueryable and IQueryProvider; I found creating the custom query provider to be very interesting, as there’s probably no better way to grasp the concepts of LINQ’s internals.

A gigantic benefit that we gain when using this custom IQueryProvider I created (OmniQueryProvider) is the ability to use LINQ expressions without having to waste performance. This is in contrast to doing a general search for all of the entities and THEN filtering them out with an expression. That’s a horrible use for LINQ. The OmniQueryProvider creates a query that will only return a result set that conforms to our conditions, which allows us to use LINQ without being idiots.

Feel free to browse the source, try it out, or whatever. I’m not going to go into depth regarding how the custom query provider was created. I’d prefer, instead, to just demonstrate how one can use it. Read on for some examples.

Downloads:

Lastest source of Omniscientist.Cloud.SqlServices

Binaries of Omniscientist.Cloud.SqlServices (not guaranteed to be latest)

Continue reading »

 

Due to loss of old server, source is not available. Links are being stripped until code is put back up online.

The Omniscientist.Cloud.SQLServices library has been updated to include BLOB functionality. It has also undergone a significant structural overhaul. I still consider it to be in its infancy, but I think it has started to become useful.

A sample application has been developed in order to showcase the new functionality, by the name of ‘Cloud Photos’. It allows the user to upload and view images stored in the cloud; specifically, in a dedicated SQL Data Services container.

Download the ‘Cloud Photos’ sample application binary here.

View the ‘Cloud Photos’ source code here.

Read on for a brief overview of BLOB’s w/ Azure SQL Data Services, and how to manipulate them with my library.

Continue reading »

© 2012-2013 Matt Weber. All Rights Reserved. Terms of Use.