samedi 30 janvier 2010

Multi Selection TreeView in WPF, the easy way...

I was losing my precious coding time to implement a feature microsoft could do themselves... It's their fault if Genuilder is late ! :p

By the way here is how to use it.
In this example I define an implicit syle for TreeViewItem which set the border in gray when it is selected.




<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="BorderThickness" Value="1"></Setter>
<Style.Triggers>
<Trigger Property="c:TreeViewExtensions.IsSelected" Value="True" >
<Setter Property="BorderBrush" Value="Gray"></Setter>
</Trigger>
</Style.Triggers>
</Style>

...

<TreeView c:TreeViewExtensions.EnableMultiSelect="true"
c:TreeViewExtensions.SelectedItems="{Binding SelectedItems}"
ItemsSource="{Binding Items}"
... />




Here is the TreeViewExtension :


And the sample app :

lundi 11 janvier 2010

Genuilder.Extensibility Features

Well there is a long time since my last post... I was coding on Genuilder.Extensibility and restarted the design from scratch 6 times !
Well I can now a least tell you the features :

-Generate your own code just before the compilation, using the parser you want (default will be the parser of SharpDevelop).

-You can link the generated code to a file. If the file is modified, the code is re-generated, if the file is deleted, generated code is also deleted. Automatically, the code will not be generated if it is already up to date.

-You will be able to modify code files or throw build time errors.

Using all these features will be as easy as creating a class library project, referencing Genuilder.Extensibility assembly, and implementing the IPlugin interface. This assembly is called "Plugins assembly", and can contain more than one plugin.

After enabling Genuilder.Extensibility on your target project, you just have to reference the plugins assembly and compile... That's all.

No install, no hack in your visual studio, no vs addin, no nothing, it just works.