Image on Button
-
Hello All, I have windows application (VS 2008) and i added wpf user control to which i added a button and trying to set image from images folder of my project something like below: <code> <Button Height="23" Margin="117,74,108,0" Name="button1" VerticalAlignment="Top"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="\images\add.png" /> <TextBlock Grid.Column="1" Text="testing"/> </Grid> </Button> But the compiler always throws error saying "The file images\add.png is not part of the project or its 'Build Action' property is not set to 'Resource'". I changed the build action to "Resource" still doesn't work. The same works in WPF application. Any help greatly appreciated Thanks.
-
Hello All, I have windows application (VS 2008) and i added wpf user control to which i added a button and trying to set image from images folder of my project something like below: <code> <Button Height="23" Margin="117,74,108,0" Name="button1" VerticalAlignment="Top"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="\images\add.png" /> <TextBlock Grid.Column="1" Text="testing"/> </Grid> </Button> But the compiler always throws error saying "The file images\add.png is not part of the project or its 'Build Action' property is not set to 'Resource'". I changed the build action to "Resource" still doesn't work. The same works in WPF application. Any help greatly appreciated Thanks.
-
Hello All, I have windows application (VS 2008) and i added wpf user control to which i added a button and trying to set image from images folder of my project something like below: <code> <Button Height="23" Margin="117,74,108,0" Name="button1" VerticalAlignment="Top"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="\images\add.png" /> <TextBlock Grid.Column="1" Text="testing"/> </Grid> </Button> But the compiler always throws error saying "The file images\add.png is not part of the project or its 'Build Action' property is not set to 'Resource'". I changed the build action to "Resource" still doesn't work. The same works in WPF application. Any help greatly appreciated Thanks.
Yeah : NO BACKSLASHES IN WPF/Silverlight URIs!
Mark Salsbery Microsoft MVP - Visual C++ :java: