It's time for another July TechNet Guru winner!
Congratulations to Magnus (MM8), our WPF Guru winner for July! See the TechNet Guru Contributions for July 2013.
Magnus' Blog: http://blog.magnusmontin.net/
Here is the gold-medal-winning article:
WPF/MVVM: Binding the IsChecked Property of a CheckBox to Several Other CheckBoxes
Now let's look at all the winning articles:
![]() |
WPF Technical Guru - July 2013 |
|
Magnus MM8 (Magnus Montin) | WPF/MVVM: Binding the IsChecked property of a CheckBox to several other CheckBoxes | AN: "Very detailed, nice images, excellent explanations" Ed Price: "Strong introduction and good explanations for each code snippet. Terrific!" |
|
XAML guy (Peter Laker) | WPF Data, Item and Control Templates - Minimum code, maximum awesome | AN: "Love the animated gif/video. Great introduction to WPF" Ed Price: "Good workflow and the animated GIF is great! The introduction could use more of an explanation of the scenarios and problems that the code solves. Great article!" |
|
Gaurav Khanna | Editable Button in WPF | AN: "Nice code dump. Would like a little more explanation." Ed Price: "It's a good solution, but it would be better to break up the code with explanations and to describe the various concepts more." |
Only three entries and all three are winners for July. WPF is a popular technology, so hopefully we will see more entrants soon.
And here's an excerpt from the article:
Defining a GroupStyle
To define the appearance of each group of countries, i.e. a continent, you specify a GroupStyle and add it to the GroupStyle property of the ItemsControl. This property contains a collection of GroupStyle objects that determine the group style for each level of groups (to support cases where you may have multiple levels of grouping) with the entry at index 0 describing the top-level group, the entry at index 1 describing the next level and so on.
The GroupStyle class has a ContainerStyle property of type System.Windows.Style that is used to determine the style for each group item in the same level. You can completely redefine the look and feel of a group item by specifying a style that sets the Template property to a custom ControlTemplate. In the sample markup below, an Expander control with a three-state CheckBox control and a TextBlock for displaying the name of the group in its header are used. The ItemsPresenter element is used within a template to specify where the ItemsPanel with the bound objects, i.e. the Country objects in this case, defined by the ItemsControl is to be added in the control’s visual tree.
<
ItemsControl
ItemsSource
=
"{Binding Source={StaticResource countries}}"
... >
...
<
ItemsControl.GroupStyle
>
<
GroupStyle
>
<
GroupStyle.ContainerStyle
>
<
Style
TargetType
=
"{x:Type GroupItem}"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"{x:Type GroupItem}"
>
<
Expander
>
<
Expander.Header
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
CheckBox
IsThreeState
=
"True"
/>
<
TextBlock
Text
=
"{Binding Name}"
FontWeight
=
"Bold"
Margin
=
"2 0 0 0"
/>
</
StackPanel
>
</
Expander.Header
>
<
Expander.Content
>
<
ItemsPresenter
/>
</
Expander.Content
>
</
Expander
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
GroupStyle.ContainerStyle
>
</
GroupStyle
>
</
ItemsControl.GroupStyle
>
</
ItemsControl
>
Note that the style will be applied to elements of type System.Windows.Controls.GroupItem and the DataContext of each of these group elements is a MS.Internal.Data.CollectionViewGroupInternal object which you can see if you use the WPF Visualizer – a tool that lets you search and drill down the visual tree produced by WPF – when debugging the application in Visual Studio:
===================================
Read the rest here:
WPF/MVVM: Binding the IsChecked Property of a CheckBox to Several Other CheckBoxes
Thanks to Magnus (MM8) for your great contribution to the TechNet Guru contest! You can read about all the July winners here: TechNet Guru Awards - July 2013
Are you a Wiki Ninja? http://technet.com/wiki
- User Ed
helpful
Thanks Ammar!
Computers Today (part 1 of 6)
blogs.msdn.com/…/computers-today.aspx
…..
CS SPOTLIGHT: Girls in computer programming… why it matters!!!
blogs.msdn.com/…/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx
…
Computational Thinking – Videos & Papers by Jeannette Wing
blogs.msdn.com/…/computational-thinking-videos-amp-papers-by-jeannette-wing.aspx