Search code examples
c#wpfblend

WPF - PathListBoxUtils and assembly or alternative


I have made a linear PathListBox with color Rectangles with this code :

 <Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:PathListBoxUtils="clr-namespace:Expression.Samples.PathListBoxUtils;assembly=Expression.Samples.PathListBoxUtils" x:Class="Prout.MainWindow"
    Title="MainWindow" Height="1080" Width="1920">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="40*"/>
        <ColumnDefinition Width="Auto" MinWidth="1440"/>
        <ColumnDefinition Width="19*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>

    <Button Content="&lt;-" VerticalAlignment="Center" Height="19.96" Margin="0,514.52"/>
    <Button Content="-&gt;" Grid.Column="2" VerticalAlignment="Center" Height="19.96" Margin="0,514.52" Click="Button_Click"/>
    <Path x:Name="path" Data="M20.333333,280.16667 C20.333333,280.16667 315.167,48.666323 620.33367,279.33299" HorizontalAlignment="Left" Height="295.636" Margin="142.563,365.031,0,0" Stretch="Fill" Stroke="Red" StrokeThickness="2" VerticalAlignment="Top" Width="1022" Grid.Column="1"/>
    <ec:PathListBox x:Name="pathListBox" WrapItems="True" RenderTransformOrigin="0,0" SnapsToDevicePixels="True" Margin="0,0,273.949,0">

        <ec:PathListBox.LayoutPaths>
            <ec:LayoutPath SourceElement="{Binding ElementName=path}" Capacity="5" Start="0.1" Distribution="Even" FillBehavior="NoOverlap"/>
        </ec:PathListBox.LayoutPaths>
        <Rectangle Fill="AliceBlue" Height="72" Stroke="Red" StrokeThickness="2" Width="70"/>
        <Rectangle Fill="#FFA7E4E4" Height="79" Stroke="Red" StrokeThickness="2" Width="77"/>
        <Rectangle Fill="Coral" Height="77" Stroke="Red" StrokeThickness="2" Width="74"/>
        <Rectangle Fill="#FF45BF45" Height="74" Stroke="Red" StrokeThickness="2" Width="74"/>
        <Rectangle Fill="#FFDEA9DE" Height="78" Stroke="Red" StrokeThickness="2" Width="76"/>
    </ec:PathListBox>
</Grid>

It looks like that :

enter image description here

Excuse my newbiness but I wanted to use the library posted in this subject http://expressionblend.codeplex.com/releases/view/44915 which is the PathListBoxUtils for Blend 4. I am using the new Blend for Visual Studio 2013 update 4, and I have naively tried to make the assembly work in my version. But when I try to use PathLayoutItemTransformer, it is not working under .NET 4.5.1 (which is my current build framework), but working fine under .NET 4 obviously.

Is there a way to port the library to 4.5.1, or maybe use only the classes needed? Or do I have to search for an alternative to my PathListBox?


Solution

  • I think I am a bit lost and I hope this silly mistake could help someone else get to the answer. What I have done is simply get the source code here : Source code of Expression Blend Samples. From there, I simply imported the classes in which I was interested and changed the Framework built to 4.5. Controls and Behaviors magically appeared in Blend and I was able to use the classes fully. Anyway, sorry for the bother.

    EDIT : I have another trick that might help someone. I had changed the target CPU to x64, which is why I did not see the prope design in Blend. Changing it back to x32 helped me see the design.