This project is read-only.

Show Pictures instead of default image like in ActiveDirectory.Show

Aug 24, 2009 at 2:09 PM


I am sure all of you have seen this I am not a coder but I really like the idea that by changing the skin the default image of He/She is changed with real pictures of that person.

I could not investigate further his work as it is in French. Can any body please explain how he did that.



Aug 30, 2009 at 1:30 AM
Edited Aug 30, 2009 at 1:34 AM

The author of ActiveDirectory.Show altered the skin file SilverResources.xaml so that a non primary node displayed a persons image.

The BlackResources.xaml file does not include the changes made so if you compare the <!-- Male node --> part of the code in the two files, you can see what has been done to make this simple alteration.

If you go to this link:

everything was in English when I looked just now.  The new bit of code goes something like below and is almost exactly the same code used to display the image in the details panel aside from a few size changes etc.

It basically consists of  a StackPanel which holds two borders.  One border is has the persons image and is visible if they have a primary image.   The second border is a default image and is displayed when the person has no primary image. 

Hope that helps.

Code snippet:

                            <Border BorderBrush="#02747474" Background="#02000000" HorizontalAlignment="Center" Margin="10,5,10,0" VerticalAlignment="Top" BorderThickness="1,1,1,1" x:Name="AvatarPhotoBorder">
                                    <DropShadowBitmapEffect ShadowDepth="7" Softness="0.75" />
                                <Image x:Name="Avatar" Source="{Binding Path=Person.Avatar, Mode=OneWay}" Stretch="Uniform" VerticalAlignment="Top" MaxWidth="55" MaxHeight="40" HorizontalAlignment="Left" StretchDirection="Both" />
                            <Border x:Name="NoPhotoBorder" Visibility="{Binding Path=Person.HasAvatar, Converter={StaticResource ComposingConverter}, Mode=Default}" BorderBrush="#FFFFFFFF" Background="#02FFFFFF" HorizontalAlignment="Center" Margin="10,5,10,0" VerticalAlignment="Top" BorderThickness="1,1,1,1">
                                <Rectangle Fill="{DynamicResource NoPhotoBrush}" Stroke="{x:Null}" Width="30" Height="35" x:Name="NoPhotoRectangle">
                                        <DropShadowBitmapEffect ShadowDepth="7" Softness="0.75" />
                            <ContentPresenter Margin="10,0,10,3" HorizontalAlignment="Right" TextBlock.TextAlignment="Right" />