Button doesn't show inside grid row - c#

My user control seems fine with 0 errors and 0 warnings
But when I add my user control to the grid row it doesn't show all the buttons from my user control. There isn't errors or even warnings
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:UX="clr-namespace:JBoxSystem.UX" x:Class="JBoxSystem.MainWindow"
Title="MainWindow" Height="700" Width="1100" Background="#333">
<Window.Resources>
<Storyboard x:Key="playingEffect"/>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource playingEffect}"/>
</EventTrigger>
</Window.Triggers>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="79*"/>
<ColumnDefinition Width="429*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="250*"/>
<RowDefinition Height="79*"/>
</Grid.RowDefinitions>
<WindowsFormsHost Grid.Column="1"/>
<UX:AlbumSlider Grid.Column="1" Margin="10,0,0,0" Width="Auto" Height="Auto"/>
<UX:MediaPlayerBar Margin="8,12,6,371" Height="Auto" Width="Auto"/>
<UX:BottomBar Width="Auto" Height="Auto" Grid.ColumnSpan="2" Grid.Row="1"/>
</Grid>
<UserControl x:Class="JBoxSystem.UX.BottomBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JBoxSystem.UX"
mc:Ignorable="d"
d:DesignHeight="250" d:DesignWidth="1020" Background="Transparent">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/JBoxSystem;component/Resources/GlassButton.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="-15,0,15,0">
<Button Style="{StaticResource GlassButton}" Background="Blue" Margin="248,180,717,18">
<Image Width="47" Height="45" Source="Resources\Images\VolumeUp.png"/>
</Button>
<Button Style="{StaticResource GlassButton}" Background="Blue" Margin="168,180,797,18" Click="Button_Click">
<Image Width="55" Height="45" Source="Resources\Images\VolumeDown.png"/>
</Button>
<Button Style="{StaticResource GlassButton}" Width="45" Height="47" Background="Orange" Margin="323,183,652,20" Click="Button_Click">
<Image Width="55" Height="45" Source="Resources\Images\Mute.png"/>
</Button>
<Button Style="{DynamicResource SquareGlassButton}"
Margin="0,0,890,18"
Name="alphabetSearch"
Height="72"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Width="120">
<Image Width="72" Height="72" Source="Resources\Images\alphabet_search.png"/>
</Button>
<Button Style="{DynamicResource SquareGlassButton}"
Margin="0,0,442,-2"
Name="alphabetKeyboardSearch"
Height="72"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Width="120">
<Image Width="72" Height="72" Source="Resources\Images\keyboard.png"/>
</Button>
<Button Style="{StaticResource GlassButton}" Width="40" Height="40" Background="Black" Margin="413,160,567,50">
<Image Width="30" Height="30" Source="Resources\images\leftArrow.png" RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-359.529"/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</Button>
<Button Style="{StaticResource GlassButton}" Width="40" Height="40" Background="Black" Margin="583,160,397,50">
<Image Width="30" Height="30" Source="Resources\images\RightArrow.png"/>
</Button>
<Button Style="{DynamicResource SquareGlassButton}"
Margin="0,0,442,70"
Name="numberPadSearch"
Height="72"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Width="120">
<Image Width="72" Height="72" Source="Resources\Images\numbers.png"/>
</Button>
<Button Style="{DynamicResource SquareGlassButton}"
Margin="0,0,250,10"
Name="top100Search"
Height="72"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Width="120">
<Image Width="64" Height="64" Source="Resources\Images\favorite.png"/>
</Button>
<Button Style="{DynamicResource SquareGlassButton}"
Margin="0,0,122,10"
Name="waitingList"
Height="72"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Width="120">
<Image Width="64" Height="64" Source="Resources\Images\waitingList.png"/>
</Button>
</Grid>

Use VerticalAlignment="Bottom" HorizontalAlignment="Right" for glas button like this
<Button Style="{StaticResource GlassButton}" Background="Blue" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="248,180,717,18">
<Image Width="47" Height="45" Source="Resources\Images\VolumeUp.png"/>
</Button>
<Button Style="{StaticResource GlassButton}" Background="Blue" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="168,180,797,18" Click="Button_Click">
<Image Width="55" Height="45" Source="Resources\Images\VolumeDown.png"/>
</Button>
<Button Style="{StaticResource GlassButton}" Width="45" Height="47" Background="Orange" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="323,183,652,20" Click="Button_Click">
<Image Width="55" Height="45" Source="Resources\Images\Mute.png"/>
</Button>

Related

My buttons wont resize when the window is resized

When i resize the window the buttons dont resize with it, everything else like the websites do but not the buttons. i tried using "border" method but it only fixed resizing the content, the background also works fine.
<Window Title="MainWindow" Height="700" Width="980"
Background="Transparent" >
<Border>
<Grid MinHeight="1" MinWidth="1">
<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="images\tarkov wallpaper.jpg"/>
</Grid.Background>
<Button x:Name="fleam" Click="flea_click" Background="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Width="245" Height="51" Margin="734,52,0,0" BorderThickness="0" >
<Image Source="images\flea.png" Height="51" Width="235" Stretch="Fill" />
</Button>
<Button x:Name="maps" Click="map_click" Background="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Width="245" Height="51" Margin="491,52,0,0" BorderThickness="0" >
<Image Source="images\maps.png" Height="51" Width="245" Stretch="Fill" />
</Button>
<Button x:Name="ammo" Click="ammo_click" Background="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Width="245" Height="51" Margin="246,52,0,0" BorderThickness="0" >
<Image Source="images\ammo.png" Height="51" Width="245" Stretch="Fill" />
</Button>
<Button x:Name="armor" Click="armor_click" Background="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Width="245" Height="51" Margin="1,52,0,0" BorderThickness="0" >
<Image Source="images\armor.png" Height="51" Width="245" Stretch="Fill" />
</Button>
<eo:WebControl x:Name="fleamarket" Margin="10,108,10,0" Visibility="Hidden">
<eo:WebControl.WebView>
<eo:WebView Url="https://tarkov-market.com/">
</eo:WebView>
</eo:WebControl.WebView>
</eo:WebControl>
<eo:WebControl x:Name="map" Margin="10,122,-5,10" Visibility="Hidden">
<eo:WebControl.WebView>
<eo:WebView Url="https://mapgenie.io/tarkov">
</eo:WebView>
</eo:WebControl.WebView>
</eo:WebControl>
<eo:WebControl x:Name="ammon" Margin="10,108,10,10" Visibility="Hidden">
<eo:WebControl.WebView>
<eo:WebView Url="https://docs.google.com/spreadsheets/d/1_l-gYeSt2MqIw62EdMZt_wefG0yO9L7dTaRM74c2J1w/edit#gid=2023683591" >
</eo:WebView>
</eo:WebControl.WebView>
</eo:WebControl>
<Image x:Name="armorimg" Source="images/amorcont.jpg" Margin="-18,108,-18,0" Visibility="Hidden"/>
</Grid>
</Border>
</Window>
Firstly, try to define rows and columns for your Grid.
Secondly, remove the Width and Height properties for your controls.
Finally, use Margin property to determine the relative size and position of the controls inside the Grid cells.
This code will help you:
<Window Title="MainWindow" Height="120" Width="120">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Margin="10">Button 1</Button>
<Button Grid.Column="1" Margin="10">Button 2</Button>
<Button Grid.Column="2" Margin="10">Button 3</Button>
<Button Grid.Row="1" Margin="10">Button 4</Button>
<Button Grid.Column="1" Grid.Row="1" Margin="10">Button 5</Button>
<Button Grid.Column="2" Grid.Row="1" Margin="10">Button 6</Button>
<Button Grid.Row="2" Margin="10">Button 7</Button>
<Button Grid.Column="1" Grid.Row="2" Margin="10">Button 8</Button>
<Button Grid.Column="2" Grid.Row="2" Margin="10"Button 9</Button>
</Grid>
</Window>

I dont understand xaml alignment

So I struggle with the XAML alignment a bit and I hoped for someone who could help me get trough it.
This is the Code. I will break it down below:
<Grid x:Name="Output" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="0">
<StackPanel>
<Button Style="{StaticResource AppBarButtonStyle}" Click="ShowPopupOffsetClicked"/>
<Image Source="Assets/images/icon_thumbnail.png"></Image>
</StackPanel>
<Popup VerticalOffset="60" HorizontalOffset="0" x:Name="StandardPopup">
<Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}"
Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
BorderThickness="2" Width="300" Height="350">
<StackPanel >
<TextBlock>
<Run x:Name="MyRun" Text=""/>
</TextBlock>
<StackPanel Orientation="Horizontal">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBox x:Name="searchTextBox" Width="200" Height="30" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top">
<Button x:Name="firstSearch" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped" >
<Image Source="Assets/images/view_search.png"/>
</Button>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button x:Name="previous" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/left_arrow.png"/>
</Button>
<Button x:Name="next" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/right_arrow.png"/>
</Button>
</StackPanel>
<Button Content="Close" Click="ClosePopupClicked" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</StackPanel>
</Border>
</Popup>
</Grid>
This part will be MyRun Text later:
<TextBlock>
<Run x:Name="MyRun" Text=""/>
</TextBlock>
This part is the SearchBar and the search-button which should be perfectly in line. How do I do this?
<StackPanel Orientation="Horizontal">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBox x:Name="searchTextBox" Width="200" Height="30" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top">
<Button x:Name="firstSearch" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped" >
<Image Source="Assets/images/view_search.png"/>
</Button>
</StackPanel>
</StackPanel>
This is the next and previous button. It should be perfectly in line with MyRun. How would I do that?
<StackPanel Orientation="Horizontal">
<Button x:Name="previous" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/left_arrow.png"/>
</Button>
<Button x:Name="next" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/right_arrow.png"/>
</Button>
</StackPanel>
And at last will be the "Close" Button. I guess it is kinda already perfect?:
<Button Content="Close" Click="ClosePopupClicked" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
Now a screenshot of how it Looks like and how I want it to look:
This is how it is:
This is how I want it to be:
I know that I can Change the height of the popup. But when I Change the height some Things disappear (for example the close Botton won't be visible because it is too far down while the popup height is too low).
Sorry for the long post. I hope someone can help me out here.
You should be able to use a Grid with three RowDefinitions. Something like this:
<Popup VerticalOffset="60" HorizontalOffset="0" x:Name="StandardPopup">
<Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}"
Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
BorderThickness="2" Width="300" Height="350">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- row 1 -->
<StackPanel Orientation="Horizontal">
<TextBox x:Name="searchTextBox" Width="200" Height="30" Margin="0,0,3,0" />
<Button x:Name="firstSearch" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped" >
<Image Source="Assets/images/view_search.png"/>
</Button>
</StackPanel>
<!-- row 2 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button x:Name="previous" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/left_arrow.png"/>
</Button>
<Button x:Name="next" Style="{StaticResource AppBarButtonStyle}" Tapped="OnOptionItemTapped">
<Image Source="/Assets/images/right_arrow.png"/>
</Button>
</StackPanel>
<TextBlock Grid.Column="1" HorizontalAlignment="Center">
<Run x:Name="MyRun" Text=""/>
</TextBlock>
</Grid>
<!-- row 3 -->
<Button Grid.Row="2"
Content="Close" Click="ClosePopupClicked"
HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</Grid>
</Border>
</Popup>
You can adjust the space between the controls using the Margin property.

Image to fit screen size in WPF

I am trying to make an image stretch to fit the screen with preserverd aspect ratio. I thought this code would do the trick:
<Image Name="Viewer" Height="{Binding SystemParameters.PrimaryScreenHeight}" Width="{Binding SystemParameters.PrimaryScreenHeight}" Stretch="Uniform" StretchDirection="Both"/>
Regretably it seems like the image just fits to the width of the screen and crops it at the bottom.
The complete xaml code looks like this:
enter co<Window x:Class="ImageExplorer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ImageExplorer"
mc:Ignorable="d"
Title="MainWindow" WindowState="Maximized" Background="Black">
<StackPanel>
<Border BorderBrush="Black" BorderThickness="2">
<Grid Margin="0,0,0,0">
<Button Content="open" Click="OpenImage" HorizontalAlignment="Left" VerticalAlignment="Center" Width="58" Height="30" Margin="1,1,1,1" />
<Button Content="Prev." Click="GetPreviousImage" HorizontalAlignment="Left" VerticalAlignment="Center" Width="58" Height="30" Margin="120,1,1,1"/>
<Button Content="Next" Click="GetNextImage" HorizontalAlignment="Left" VerticalAlignment="Center" Width="58" Height="30" Margin="180,1,1,1" />
<Label Content="Fil:" HorizontalAlignment="Right" VerticalAlignment="Center" Width="120" Height="30" Margin="1,1,300,1"/>
<TextBlock Name="StiViser" HorizontalAlignment="Right" VerticalAlignment="Center" Width="298" Margin="1,1,1,1" TextWrapping="Wrap" Text="TextBlock"/>
</Grid>
</Border>
<Image Name="Viewer" Height="{Binding SystemParameters.PrimaryScreenHeight}" Width="{Binding SystemParameters.PrimaryScreenWidth}" Stretch="Uniform" StretchDirection="Both"/>
</StackPanel>
Use DockPanel instead
<DockPanel LastChildFill="True">
<Border DockPanel.Dock="Top" BorderBrush="Black" BorderThickness="2">
<Grid Margin="0,0,0,0">
<Button Content="open" Click="OpenImage" HorizontalAlignment="Left" VerticalAlignment="Center" Width="58" Height="30" Margin="1,1,1,1" />
<Button Content="Prev." Click="GetPreviousImage" HorizontalAlignment="Left" VerticalAlignment="Center" Width="58" Height="30" Margin="120,1,1,1"/>
<Button Content="Next" Click="GetNextImage" HorizontalAlignment="Left" VerticalAlignment="Center" Width="58" Height="30" Margin="180,1,1,1" />
<Label Content="Fil:" HorizontalAlignment="Right" VerticalAlignment="Center" Width="120" Height="30" Margin="1,1,300,1"/>
<TextBlock Name="StiViser" HorizontalAlignment="Right" VerticalAlignment="Center" Width="298" Margin="1,1,1,1" TextWrapping="Wrap" Text="TextBlock"/>
</Grid>
</Border>
<Image Name="Viewer" Height="{Binding SystemParameters.PrimaryScreenHeight}" Width="{Binding SystemParameters.PrimaryScreenWidth}" Stretch="Fill" StretchDirection="Both"/>
</DockPanel>

Black area to the right, inside window

A large black area appears on the right side of the window when I run the program, and I can't figure out why. It's not there in the preview on the XAML file page in Visual Studio 2017, and I ran it once on a Windows 7 computer, and the black area wasn't there (I'm primarily on Windows 10). The problem could possibly be in another file, but I cannot find it.
<Window x:Class="Project.Widget"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Project"
mc:Ignorable="d"
Title="Menu"
WindowStartupLocation="Manual"
ResizeMode="NoResize"
Width="109"
SizeToContent="WidthAndHeight"
WindowState="Minimized"
Background="#2D3A48"
Topmost="False"
Loaded="Window_Loaded"
Closing="Window_Closing" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="77"/>
<RowDefinition Height="28"/>
<RowDefinition Height="90"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Image x:Name="Icon"
Source="./Resources/Icon.png"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Height="77"
Width="109" />
<Label x:Name="labelUsername"
Grid.Row="1"
Content=""
FontSize="14"
Foreground="White"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" />
<Label x:Name="labelScore"
Grid.Row="2"
Content="0%, 0 of 0"
Foreground="White"
FontSize="14"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,0,0,0" />
<Image x:Name="AvgScoreDot"
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Height="50"
Source=".\Resources\yellow_dot.png"
Margin="0,32,0,0"/>
<Label x:Name="labelAvgScore"
Grid.Row="2"
Content="0.0"
Foreground="White"
FontSize="24"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,35,0,0"
FontWeight="Bold" />
<Button x:Name="MailBtn"
Grid.Row="3"
Height="60"
Width="109"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderBrush="#FF2D3A48"
Click="Mail_Click" >
<Button.Background>
<ImageBrush
ImageSource="/Resources/mail.png"
Stretch="None" />
</Button.Background>
</Button>
<Button x:Name="MailBadgeBtn"
Grid.Row="3"
Content="0"
Foreground="White"
FontSize="11"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Height="20"
Width="20"
Margin="0,30,24,10"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="MailBadgeBtn_Click" BorderThickness="0">
<Button.Background>
<ImageBrush
ImageSource=".\Resources\red_dot.png" />
</Button.Background>
</Button>
<TextBlock x:Name="labelConnection"
Grid.Row="0"
Text=" No Connection or blocked by Firewall"
Foreground="Red"
Background="White"
TextWrapping="Wrap"
TextAlignment="Center"
VerticalAlignment="Center"
Height="77"
Width="109"
HorizontalAlignment="Center" />
</Grid>
Here's an image of what I get when I run it:
Here's what I get when I remove SizeToContent="WidthAndHeight" and add a height of 300 (I also had to remove your event handlers since I don't have that code, and add garbage images to the Resources folder since I don't have the original images):
Is that more like what you were looking for? You can also choose to explicitly set SizeToContent to "Manual".

Using an image as a background

I'm working on wpf application , and i want to use the shape of an exsiting image . i made the background of the windows transparent and i added the image , and some buttons but when i excute the application nothing apears .
here is the code
<Controls:MetroWindow x:Class="Selen.Wpf.DemoApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:System="clr-namespace:System;assembly=mscorlib" Title="A propos "
Height="300" Width="450" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" TitleForeground="#999988" Background="Transparent"
WindowStyle="None" ShowMaxRestoreButton="False" SizeToContent="WidthAndHeight" AllowsTransparency="True" >
<Grid >
<Border CornerRadius="20,20,20,20" Background="Cornsilk"/>
<Image Height="300" Width="450" Name="test" Source="test1.png" Visibility="Visible"
Stretch="Fill" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Button x:Name="projet" Width="40" Background="Transparent" Visibility="Visible" Margin="64,0,346,260" Click="projet_Click" Cursor="Hand" Height="40" VerticalAlignment="Bottom" >
<Image Width="40" Height="40" Source="pro.png"></Image>
</Button>
<Button x:Name="equipe" Background="Transparent" Width="40" Visibility="Visible" Margin="105,0,305,260" Click="equipe_Click" Cursor="Hand" >
<Image Source="equ.png" Width="40" Height="40" ></Image>
</Button>
<Button x:Name="outils" Width="40" Background="Transparent" Margin="146,0,264,260" Visibility="Visible" Click="outils_Click" Cursor="Hand" Height="40" VerticalAlignment="Bottom" >
<Image Source="outi.png" Width="40" Height="40" ></Image>
</Button>
<TextBlock x:Name="titr" Height="30" Width="350" Margin="10,67,90,203" FontSize="16" TextDecorations="Underline" Foreground="White" Text="Modélisation des surfaces topographique :" />
<TextBlock x:Name="txt" Height="180" Width="300" Margin="10,102,140,18" Text="le text sera met ici" Foreground="White" />
<Image x:Name="image" Height="100" Width="100" Margin="328,130,22,70" />
</Grid>
how can i solve that problem ?
ps : i did already add the image to the project .
You have to use Source="/ApplicationName;component/Images/imagename.png" .
Under the brush catagory in your pages properties Select the background (Has an image icon)
Then set the image source to your picture. it should be in the drop down list
Change the build action of the images to 'Resource'. Also your images path seems to be wrong.
Your Project Setup should like this,
and XAML is
<Grid >
<Border CornerRadius="20,20,20,20" Background="Cornsilk"/>
<Image Height="300" Width="450" Name="test" Source="Images/test1.png" Visibility="Visible"
Stretch="Fill" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Button x:Name="projet" Width="40" Background="Transparent" Visibility="Visible" Margin="64,0,346,260" Click="projet_Click" Cursor="Hand" Height="40" VerticalAlignment="Bottom" >
<Image Width="40" Height="40" Source="Images/equ.png"></Image>
</Button>
<Button x:Name="equipe" Background="Transparent" Width="40" Visibility="Visible" Margin="105,0,305,260" Click="equipe_Click" Cursor="Hand" >
<Image Source="Images/outi.png" Width="40" Height="40" ></Image>
</Button>
<Button x:Name="outils" Width="40" Background="Transparent" Margin="146,0,264,260" Visibility="Visible" Click="outils_Click" Cursor="Hand" Height="40" VerticalAlignment="Bottom" >
<Image Source="Images/pro.png" Width="40" Height="40" ></Image>
</Button>
<TextBlock x:Name="titr" Height="30" Width="350" Margin="10,67,90,203" FontSize="16" TextDecorations="Underline" Foreground="White" Text="Modélisation des surfaces topographique :" />
<TextBlock x:Name="txt" Height="180" Width="300" Margin="10,102,140,18" Text="le text sera met ici" Foreground="White" />
<Image x:Name="image" Height="100" Width="100" Margin="328,130,22,70" />
</Grid>
</Grid>

Categories