Varigence, Inc.

The Varigence Blog

Empowering everyone to be smarter decision makers with the power of Varigence Tools and Frameworks.

Tags >> Developer

Presented by 


Microsoft has recently started a new program called SSAS Maestros.  An extremely deep technical training course on Analysis Services, which includes labs and even a take home exam project.  

There were hundreds of applicants and eighty-one attendees.  From that pool Microsoft recently announced their first class of 11 SSAS Maestros, and I'm happy to congratulate my colleague John Welch for being part of this elite group!

I work with John, so I can honestly say I'm not surprised to hear about this, but nevertheless it's a great honor for him.  Way to go John, and congrats to the other ten Maestros!


This is the first blog entry focused on helping users prepare for the $10,000 Biml Challenge. This will get you a basic understanding of the BI markup language, Biml.

Biml is an XML-based language for specifying the full set of assets in a BI and/or DW project. With Biml you can design everything from relational databases, to data integration and transformation packages, and OLAP cubes. The Biml language is fully specified online. The rest of the blog entry will give a more informal look into how to use Biml.

Biml works in a way consistent with other XML-based languages. If you want to define something in Biml, specify the element for that item. For example,


When you have a technology that drastically increases the productivity of BI and Data Warehouse developers and architects, it can be difficult to convey just how groundbreaking it is. We believe Mist & Biml are such products.  Once you have the chance to use them, you'll never want to go back to the old way of building your data solutions.

This year at PASS Summit (October 2011, Seattle, WA), we're putting our money where our mouth is by sponsoring the $10,000 Biml Challenge during the exhibition.  

The contestant who solves a typical BI/DW task assigned in the competition the fastest will win $10,000 cash.  This task would normally require hours or longer with traditional approaches, but with Biml and Mist, the time limit will be a generous 15 minutes.


For a long time, I assumed that whenever I needed a DataGridCell to display a custom control, my only solution was to use a DataGridTemplateColumn. And admittedly, a DataGridTemplateColumn is a reasonable way to display custom cells. However, I recently discovered an alternative approach for creating custom cells, using a DataGridColumn's EditingElementStyle property, that helped me out and definitely warrants discussion.

My scenario was that the Expression DataGrid in Mist needed a custom text cell for an Expression's expression property. Along with a text field, I wanted to provide a button to display the expression builder dialog box. I wrote a custom control for the cell, which is basically a Grid with two columns; the left column is the TextBox and the right column contains the button.


First off, let me briefly introduce myself. My name is Craig and I'm the lead developer on Mist. My blog posts will typically be focused on developing Mist and developing BI solutions in Mist.

I recently encountered a situation where I needed to override a binding's value without changing the binding. If that statement seems confusing to you, allow me to back up and explain further.

Background:

All of the designers in Mist are implemented as WPF Pages. Within each designer is a variety of controls, e.g., ComboBoxes, DataGrids, CheckBoxes. Many of these controls have their IsEnabled bindings set in XAML.

A scenario arose where we wanted the user to be able to view an editor's content, but not edit it. Sort of a 'look but don't touch' behavior. At first glance, this seemed like a trivial problem; simply add or alter IsEnabled bindings to detect when to disable each control. The problem I faced was that each designer has lots of controls, all of which would need to implement this behavior. Furthermore, many of them already have IsEnabled bindings. I really didn't want to deal with the time consuming and cumbersome choice of adding or editing each control's IsEnabled binding. I also wanted to avoid the maintenance cost of ensuring that all future changes account for this new IsEnabled logic.

Solution:

Some of you may already be thinking that the right way to solve this is to use default styles. And you're right. (For those of you unfamiliar with default styles, check out MSDN Default (Theme) Styles and view a simple example at Inheriting Default Styles in WPF). But the problem remains of how to change the default style so we can override the control's IsEnabled value while still preserving its binding.

The way I chose to solve this was by using an attached property:

    public static class ControlExtension
    {
        public static readonly DependencyProperty IsReadOnlyProperty =
            DependencyProperty.RegisterAttached(
                "IsReadOnly",
                typeof(bool),
                typeof(ControlExtension),
                new PropertyMetadata(false, new PropertyChangedCallback(OnIsReadOnlyChanged)));

        public static void SetIsReadOnly(DependencyObject element, string value)
        {
            element.SetValue(IsReadOnlyProperty, value);
        }

        public static object GetIsReadOnly(DependencyObject element)
        {
            return element.GetValue(IsReadOnlyProperty);
        }

        private static void OnIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue is bool)
            {
                if ((bool)e.NewValue)
                {
                    d.SetValue(UIElement.IsEnabledProperty, false);
                }
                else
                {
                    d.ClearValue(UIElement.IsEnabledProperty);

                    var bindingExpression = BindingOperations.GetBindingExpression(d, UIElement.IsEnabledProperty);
                    if (bindingExpression != null)
                    {
                        bindingExpression.UpdateTarget();
                    }
                }
            }
        }
    }

When IsReadOnly becomes true, we set the DependencyObject's IsEnabled property to false, thus forcibly disabling the control. Note that any IsEnabled bindings on that DependencyObject will be ignored, due to SetValue. If IsReadOnly returns to being false, we first clear the IsEnabled property's value and, if the control has an IsEnabled binding, we then call UpdateTarget to refresh the binding's value.



To add this behavior in XAML, we can create or edit a default style for each relevant control, setting a binding to its IsReadOnly attached property. Our controls will then inherit their theme styles and use the new behavior.


Craig Lichtenstein


You've made it to the Varigence blog, welcome! 

The first thing you should know is who we are.  Varigence team members live and breathe business intelligence and application development.  We were brought together by a vision that business intelligence could be made much more efficient and effective.    As a business we currently have one shipping product, Vivid, and another product, Mist, slated for release at the end of January 2011. Varigence also provides consulting and training services to help customers accelerate adoption of our products and frameworks.

The goals of this blog are:


Subscribe:
To Our Email Newsletter
To This Blog via RSS
Categories:
Latest Twitter News:
    Twitter Follow Varigence on Twitter
    About Us
    Varigence was founded as a privately held company in 2008 with headquarters in Greenville, SC and offices in Seattle, WA. Employing a mix of deep experience in developer tools, business intelligence, and consumer software products, Varigence applies the best innovations from application development to enterprise business intelligence while offering an unprecedented level of accessibility to the end-user. Varigence has delivered state-of-the-art business intelligence solutions to Fortune 100 companies.