What has been done during 2011 year?

This year is almost finished and I’d like to summarize what has been done, what I should improve. New Year’s good time to know: where you are on the road map, add new goal to life and analyse productivity.

If you want to do something grandiose in one of the beautiful days,

remember – this day is today!

(c) George Lucas

This list I had in the beginning of 2011 year (of course without my private goals which all have been done) and what has been done:

  1. Change a job.Success

    I have been working for 3 years for one company in Ukraine. It was my first job, I grown there from junior-developer to senior developer. I met a lot of interesting people; I worked with customers which gave me knowledge in variety areas. However, on someday I realize that our ways are different, that I need something more in business and technical knowledge. For this I decided to push myself a little bit. My new company was in the Donetsk, Ukraine too. I worked there around half a year as a head of .NET department but on not good productL. (Why I left that company on the next item).

  2. Immigration.Success

    In a university I made a decision to work (or live) abroad. In 2011 year I had decided to do it. As a result I’m working with high-motivated professionals for fantastic company in Antwerp city, Belgium.

  3. Visit one of the solid conferences.Success

    On November 14-15, 2011 I’ve visited a SQL Server Days 2011. If you want to know more please read this post about first day and this one about second day in a conference.

  4. Pass 70-564 and become a MCPD ASP.NET developer.Success
  5. Read 10 books.Success

    At the end of the year I read around 15-20 maybe (I calculated only technical books). So this item was underestimated. As a result on the next year I put 20 (I don’t want to improve this now because I need time for other things). Last book were about project management and Agile You can find some of them on my LinkedIn profile. And I’m planning to move on that direction. I feel that I need more knowledge on business too (Maybe for this I’ll graduate some business college or university here in Belgium. I already have one which interesting for me. It’s EHSAL Management School. So if you know something or ever graduated that one please live a comment!)

  6. Pass 70-523: upgrade MCPD ASP.NET 3.5 to MCPD ASP.NET 4.0.Fail

    It was one of things which I decided not to do and really regret about. Last year all my projects were Silverlight. I’m feeling shortage of experience on this area. However I’m not sure that I put it to the next year’s list.

  7. English: pass IELTS.Fail

    I’m absolutely sure that this one is the biggest my fault. I definitely need to improve my English. I decided not to take this but I’m 100% sure that “pass IELTS” is one of the strong motivated factors. This item is absolutely MUST HAVE on my next year’s list.

  8. Create a first Windows Phone 7 application.Fail

    I decided to move on this direction. I really like this OS and Metro style. I’m working around 3 month on my application. Now I think it’s ready on 60%-70%. I still should implement good design and publish it on marketplace. Hope, I can do it on February.

  9. Create a blog with N-thousands visitors.Success

    At the end of the year I’ve exceeded this item on 155%. However, now I think it’s my mistake. I shouldn’t evaluate blog by “visitor” measure. I need to think about this item on next year because I don’t satisfy with “post count” measure too.

In a conclusion I would like to maintain that 2011 year was really productive for me with a lot of fun and success. I hope next one would be ever more interesting and productive. Also I’d like to say thank you everyone how was on this year with me!

I hope you all enjoyed Christmas, and I wish you all a happy and productive 2012 year!

Choose control style in XAML through converter.

Frequently we need to change control style (or template) dynamic. Of course it can be done on different ways:

  • Put two controls and “play” with Visibility property and binding – I suppose it’s the less smart case;
  • You can choose DataTemplate/ControlTemplate in code behind file;
  • And use converter.

I’ll show the last one.

The task is: we have a control (in my case it’s just an expand/collapse button) and we need to choose appropriate style for this control which depends on a model.

I created two styles:

  1. True style for expanded state
     <Style TargetType="Button">
                    <Setter Property="Width" Value="13" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid Width="13" Height="13" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent" Cursor="Hand">
                                    <Rectangle StrokeThickness="1" Stroke="{Binding ForegroundColor}" RadiusX="2" RadiusY="2" />
                                    <Rectangle Fill="{Binding ForegroundColor}" Height="1" VerticalAlignment="Center" Margin="3" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
  1. False style for collapsed state
    <Style TargetType="Button">
                    <Setter Property="Width" Value="13" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid Width="13" Height="13" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent" Cursor="Hand">
                                    <Rectangle StrokeThickness="1" Stroke="{Binding ForegroundColor}" RadiusX="2" RadiusY="2" />
                                    <Rectangle Fill="{Binding ForegroundColor}" Height="1" VerticalAlignment="Center" Margin="3" />
                                    <Rectangle Fill="{Binding ForegroundColor}" Width="1" HorizontalAlignment="Center" Margin="3"  />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

Next step, I create a BoolToStyleConverter:

    public class BoolToStyleConverter : IValueConverter
    {
        public Style TrueStyle { get; set; }

        public Style FalseStyle { get; set; }

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return ((bool)value) ? TrueStyle : FalseStyle;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }

Also I create model with following properties:

    public class TaskModel
    {
        public bool IsExpanded { get; set; }

        public Brush ForegroundColor { get; set; }
    }

As a result, I’ve got following behavior only in a XAML. Additionally, I can use a bind (in my case it’s just a foreground color of the model to my style).

Expanded state

Collapsed state

Enjoy!