Click here to Skip to main content
15,917,538 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I write a paint program in WPF .but when i run it my icons images are invisible .
this is my code:
XML
<Window x:Class="for_final.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="512" Width="1159.6">
    <Grid    HorizontalAlignment="Stretch" VerticalAlignment="Stretch" removed="LightGray" Margin="10,0,2,0" >
        <Grid.RowDefinitions>
            <RowDefinition Height="118*"/>



            <RowDefinition Height="319*"/>
            <RowDefinition Height="45*"/>

        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="4*"/>


            <ColumnDefinition Width="179*"/>
            <ColumnDefinition Width="0*"/>
            <ColumnDefinition Width="9*"/>
        </Grid.ColumnDefinitions>
        <ScrollBar Grid.Column="3" HorizontalAlignment="Left" Margin="39,0,-3,0" Grid.Row="1" />
        <StatusBar Grid.ColumnSpan="4" HorizontalAlignment="Stretch"  Grid.Row="2" VerticalAlignment="Stretch" />
        <Canvas Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="1" VerticalAlignment="Stretch" Margin="0,7" />

        <InkCanvas x:Name="Ic1" EditingMode="Ink" ClipToBounds="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Margin="0,10,19,10" Grid.Row="1" Grid.ColumnSpan="3"/>
        <TabControl Grid.ColumnSpan="3" Grid.Column="1" HorizontalAlignment="Left" Height="118" VerticalAlignment="Top" Width="1116">
            <TabItem Header="TabItem">
                <Grid removed="#FFE5E5E5" Margin="0,-3,0,-6">
                    <Button HorizontalAlignment="Left" VerticalAlignment="Top" Width="101" Margin="89,11,0,0" RenderTransformOrigin="0.5,0.5" Height="37" >
                        <WrapPanel Height="27" Width="85">
                            <Image HorizontalAlignment="Left"  VerticalAlignment="Center"  Source="1432808609_Cut.png" Width="45"/>
                            <TextBlock Text="Cut" Width="31"/>
                        </WrapPanel>
                    </Button>
                    <Button HorizontalAlignment="Left" VerticalAlignment="Top" Margin="89,52,0,0" Height="32" Width="101">
                        <WrapPanel>
                            <Image HorizontalAlignment="Left" VerticalAlignment="Center"  Source="1432808745_Copy.png" RenderTransformOrigin="0.52,0.44" Width="45"/>
                            <TextBlock Text="Copy" Width="38"/>
                        </WrapPanel >
                    </Button>
                    <Button  HorizontalAlignment="Left" VerticalAlignment="Top" Width="61" Margin="10,1,0,0" Height="83" >
                        <StackPanel>
                            <Image Height="37" Width="41" Source="1432808493_edit-paste.png"/>
                            <TextBlock Text="Paste" Width="30"/>
                            <ComboBox >
                                
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Paste"/>
                                        <Image Source="1432808493_edit-paste.png"/>
                                        
                                    </StackPanel>
                               
                            </ComboBox>
                        </StackPanel>
                    </Button>

                    <Button  HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Click="Button_Click_1" Margin="203,2,0,0" Height="83">
                        <StackPanel>
                            <Image Height="37" Width="41" Source="1432808803_Select.png"/>
                            <TextBlock Text="Select" Width="35"/>
                            <ComboBox/>
                        </StackPanel>
                    </Button >
                    <Button  HorizontalAlignment="Left" VerticalAlignment="Top" Width="66" Margin="264,63,0,0" Click="Button_Click" Height="30">
                        <WrapPanel>
                            <Image HorizontalAlignment="Left" VerticalAlignment="Center"  Source="1432808943_rotate-right.png"/>
                            <TextBlock Text="Rotate" Height="15"/>
                        </WrapPanel>
                    </Button>
                    <Button  HorizontalAlignment="Left" VerticalAlignment="Top" Width="66" Margin="264,34,0,0" Height="29">
                        <WrapPanel>
                            <Image HorizontalAlignment="Left" VerticalAlignment="Center"  Source="1432808872_resize.png"/>
                            <TextBlock Text="Resize" Height="15"/>
                        </WrapPanel>
                    </Button>
                    <Button HorizontalAlignment="Left" VerticalAlignment="Top" Width="66" Margin="264,1,0,0" Height="33">
                        <WrapPanel>
                            <Image HorizontalAlignment="Left" VerticalAlignment="Center"  Source="1432808841_Streamline-31.png"/>
                            <TextBlock Text=" Crop" Height="15"/>
                        </WrapPanel>
                    </Button>
                    <Button HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Margin="341,48,0,0" Height="36">
                        <DockPanel>
                            <Button  Height="27" Width="28" HorizontalAlignment="Left" VerticalAlignment="Bottom" >
                                <Image Source="1432809130_eraser.png"/>
                            </Button>
                            <Button  HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                <Image Source="1432809179_color_line.png" Height="21" Width="25"/>
                            </Button>
                            <Button  HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                <Image Source="1432809215_find_in_magnifier_magnifying_research_search_view_zoom.png" Height="21" Width="25"/>
                            </Button>
                        </DockPanel>
                    </Button>
                    <Button  HorizontalAlignment="Left" VerticalAlignment="Top" Width="60" Margin="458,0,0,-7" Height="93">
                        <StackPanel>
                            <Image Height="37" Width="41" Source="paint-can-with-brush_256x256.png"/>
                            <TextBlock Text="Brush" Width="30"/>
                            <ComboBox/>
                        </StackPanel>
                    </Button>
                    <Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="725,14,0,0" Height="29"/>
                    <Button Content="Button" HorizontalAlignment="Left" Height="93" Margin="819,0,0,0" VerticalAlignment="Top" Width="49"/>
                    <Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="48" Margin="873,1,0,0" Height="93"/>
                    <GridSplitter HorizontalAlignment="Left" Height="93" Margin="195,0,0,0" VerticalAlignment="Top" Width="1"/>
                    <GridSplitter HorizontalAlignment="Left" Height="93" Margin="335,0,0,0" VerticalAlignment="Top" Width="1"/>
                    <Button  HorizontalAlignment="Left" Height="37" Margin="341,10,0,0" VerticalAlignment="Top" Width="100">
                        <DockPanel>
                            <Button  Height="27" Width="28" HorizontalAlignment="Left" VerticalAlignment="Bottom" >
                                <Image Source="1432809625_15.Pencil.png" />
                            </Button>
                            <Button  HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                <Image Source="1432809031_bg_color.png" Height="24"/>
                            </Button>
                            <Button  HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                <Image Source="1432809075_Untitled-2-26.png" Height="24" Width="25"/>
                            </Button>
                        </DockPanel>
                    </Button>
                    <GridSplitter HorizontalAlignment="Left" Height="94" Margin="446,2,0,-1" VerticalAlignment="Top" Width="1"/>
                    <GridSplitter HorizontalAlignment="Left" Height="93" Margin="536,0,0,0" VerticalAlignment="Top" Width="1"/>
                    <Button Content="Button" HorizontalAlignment="Left" Height="26" Margin="725,52,0,0" VerticalAlignment="Top" Width="75"/>
                    <StackPanel HorizontalAlignment="Left" Height="93" Margin="542,0,0,0" VerticalAlignment="Top" Width="183"/>
                    <Grid HorizontalAlignment="Left" Height="92" Margin="926,1,0,0" VerticalAlignment="Top" Width="180">
                        <Rectangle x:Name="rectblack" Fill="Black" Height="21" Margin="0,10,159,61" />
                        <Rectangle x:Name="rectwhiht" Fill="White" Height="21" Margin="0,36,159,35" />
                        <Rectangle x:Name="rectgray" Fill="Gray" Height="21" Margin="26,10,133,61" />
                        <Rectangle x:Name="rectlgray" Fill="LightGray" Height="21" Margin="26,36,133,35" />
                        <Rectangle x:Name="rectdred" Fill="DarkRed" Height="21" Margin="130,10,29,61" />
                        <Rectangle x:Name="rectbrown" Fill="Brown" Height="21" Margin="104,36,55,35" />
                        <Rectangle x:Name="rectred" Fill="Red" Height="21" Margin="104,10,55,61" />
                        <Rectangle x:Name="rectorange" Fill="Orange" Height="21" Margin="78,36,81,35" />
                        <Rectangle x:Name="rectgold" Fill="Gold" Height="21" Margin="78,10,81,61" />
                        <Rectangle x:Name="rectyellow" Fill="Yellow" Height="21" Margin="52,10,107,61" />
                        <Rectangle x:Name="rectlightyellow" Fill="LightYellow" Height="21" Margin="52,36,107,35" />
                    </Grid>
                </Grid>
            </TabItem>
            <TabItem Header="TabItem">
                <Grid removed="#FFE5E5E5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="144*"/>
                        <ColumnDefinition Width="409*"/>
                    </Grid.ColumnDefinitions>
                    <Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="57" Height="76"/>
                    <Button Content="Button" HorizontalAlignment="Left" Height="76" Margin="62,0,0,0" VerticalAlignment="Top" Width="55"/>
                    <Button Content="Button" HorizontalAlignment="Left" Height="76" Margin="122,0,0,0" VerticalAlignment="Top" Width="55"/>
                    <Separator HorizontalAlignment="Left" Height="86" Margin="182,0,0,0" VerticalAlignment="Top" Width="1"/>
                    <CheckBox Content="CheckBox" HorizontalAlignment="Left" Height="19" Margin="198,10,0,0" VerticalAlignment="Top" Width="106" Grid.ColumnSpan="2"/>
                    <CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="198,50,0,0"/>
                    <CheckBox Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="198,29,0,0"/>
                    <Button Content="Button" Grid.Column="1" HorizontalAlignment="Left" Height="76" Margin="10,0,0,0" VerticalAlignment="Top" Width="56"/>
                    <Button Content="Button" Grid.Column="1" HorizontalAlignment="Left" Height="76" Margin="71,0,0,0" VerticalAlignment="Top" Width="55"/>
                </Grid>
            </TabItem>
        </TabControl>

    </Grid>

</Window>
Posted
Updated 1-Jun-15 1:15am
v2
Comments
gggustafson 31-May-15 22:36pm    
is this homework?
Akbar Fardi 1-Jun-15 0:57am    
yes
Andy Lanng 1-Jun-15 7:45am    
The point of his question was that we know this is homework and we don't usually do peoples homework for them.
This is because it is best to ask your tutor for help. He / She might have a specific way they want it done. Also, this site comes up in plagiarism programs so you might be marked as failing just for getting the answer here.

It sucks but we can't do much with homework related questions
Kornfeld Eliyahu Peter 1-Jun-15 7:48am    
Are images invisible or are not loaded? Are you sure the images you described in the XAML are there?
Akbar Fardi 1-Jun-15 8:09am    
they are
invisible

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900