views:

45

answers:

1

Hi,

I'm extending the available WPF's TreeView control. I wish to add to it CheckBox behavior like Josh Smith has suggested.

My goal is to encapsulate all checkbox behavior concerns from the end user (which is a different approach of what josh Smith has done).

I would like to use a style for the TreeViewItem in order to add some properties and bindings as described in the article. So I have created a style, pushed him to the generic.xaml and called it TreeViewItemStyle.

My requirment is that I still wish that the end user can add a style (for colors and theme) on his own.

One way to do that is using the BaseOn property of the style, but it must use StaticResource and it fails to find my style, TreeViewItemStyle.

Is there a workaround? is it actully a good approach? what do you do?

Ariel

A: 

Did you include the generic.xaml file in the new resource dictionary you are trying to create?

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
    <ResourceDictionary.MergedDictionaries>
     <ResourceDictionary Source="pack://application:,,,/ASSEMBLY;component/Resources/generic.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="NewStyle" BasedOn="{StaticResource TreeViewItemStyle}">

    </Style>
</ResourceDictionary>
Zenuka
I had hoped that the magic beyond generix.xaml would merged it before.
ArielBH