Hi all,
I found an issue with textblock in my Silverlight application. As observed from the picture I attached, in the "How to play" silverlight page, the title are bound to disappear if I navigate from different route.
Please note that that is static textblock with static wording. Just that from different navigation point, the header wording is missing!
I navigate from screen to screen using this.content = new something; (e.g. : this.content = new instruction())
Can someone guide me on how to overcome this issue? All my page is not usercontrol, but just silverlight page.
<navigation:Page x:Class="SpotTheDifference.UI.Game.Silverlight.instruction"
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"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="893" d:DesignHeight="670"
Title="BonusLink Spot 'd' Difference">
<Grid x:Name="LayoutRoot">
<Image x:Name="imgBG" HorizontalAlignment="Left" Height="670" VerticalAlignment="Top" Width="893" Source="/img/bg/dialogbox-bg.jpg" Visibility="Visible"/>
<Image x:Name="imgPlayGame" HorizontalAlignment="Left" Height="50" Margin="731,209,0,0" VerticalAlignment="Top" Width="145" Source="/img/btn/btn_play_red.png"/>
<Button x:Name="btnPlay" Content="" HorizontalAlignment="Left" Margin="731,209,0,0" VerticalAlignment="Top" Width="145" Height="50" Opacity="0" Click="btnPlay_Click" MouseEnter="btnPlay_MouseEnter" MouseLeave="btnPlay_MouseLeave"/>
<Image x:Name="imgScoreBoard" HorizontalAlignment="Left" Height="50" Margin="731,264,0,0" VerticalAlignment="Top" Width="145" Source="/img/btn/btn_scoreboard_red.png"/>
<Button x:Name="btnScoreBoard" Content="" HorizontalAlignment="Left" Margin="731,264,0,0" VerticalAlignment="Top" Width="145" Height="50" Opacity="0" Click="btnScoreBoard_Click" MouseEnter="btnScoreBoard_MouseEnter" MouseLeave="btnScoreBoard_MouseLeave"/>
<Image x:Name="imgProfile" HorizontalAlignment="Left" Height="50" Margin="731,319,0,0" VerticalAlignment="Top" Width="145" Source="/img/btn/btn_profile_red.png"/>
<Button x:Name="btnProfile" Content="" HorizontalAlignment="Left" Margin="731,319,0,0" VerticalAlignment="Top" Width="145" Height="50" Opacity="0" Click="btnProfile_Click" MouseEnter="btnProfile_MouseEnter" MouseLeave="btnProfile_MouseLeave"/>
<Image x:Name="imgHowToPlay" HorizontalAlignment="Left" Height="50" Margin="731,374,0,0" VerticalAlignment="Top" Width="145" Source="/img/btn/btn_howto_green.png"/>
<Image x:Name="imgLogOut" HorizontalAlignment="Left" Height="50" Margin="731,429,0,0" VerticalAlignment="Top" Width="145" Source="/img/btn/btn_logout_red.png"/>
<Button x:Name="btnLogOut" Content="" HorizontalAlignment="Left" Margin="731,429,0,0" VerticalAlignment="Top" Width="145" Height="50" Opacity="0" Click="btnLogOut_Click" MouseEnter="btnLogOut_MouseEnter" MouseLeave="btnLogOut_MouseLeave"/>
<TextBlock x:Name="lblDesc" HorizontalAlignment="Left" Margin="145,250,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="505" Height="195" Foreground="#FF007EFF" FontFamily="Comic Sans MS" FontSize="14.667" FontWeight="Bold">
<Run Text="There will be a set of 2 almost identical pictures revealed every month for players to identify 10 differences each."/>
<LineBreak/>
<Run/>
<LineBreak/>
<Run Text="With every correct click, a circle will appear on the difference spot; whereas every wrong click, the timer will be further reduced."/>
<LineBreak/>
<Run/>
<LineBreak/>
<Run Text="Total play time for this game is 30 seconds."/>
<LineBreak/>
<Run Text="(Hint: The faster you identify the differences, the higher the score)"/>
</TextBlock>
<TextBlock x:Name="lblHeader" Text="Spot 'd' Difference: How to Play Instruction" Margin="146,214,275,427" FontFamily="Comic Sans MS" FontSize="21.333" FontWeight="Bold" Width="472" Height="29" />
</Grid>
Related
I want to add a refresh button to my app so that I don't always have to quit the app to clear the data.
I have tried a RefreshRequested, but I can't make it work.
C# code:
private void RefreshButtonClick(object sender, RoutedEventArgs e)
{
RefreshContainer.requestRefresh();
}
<RefreshContainer>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="910" Height="383" Margin="0,0,0,0">
<RelativePanel
HorizontalAlignment="Center" BorderBrush="DarkOliveGreen" BorderThickness="8" Background="FloralWhite" Height="356" VerticalAlignment="Center" Width="871" Margin="0,0,0,0" Visibility="Visible" RequestedTheme="Default">
<AppBarButton x:Name="RefreshButton" Click="RefreshButtonClick"
Icon="Refresh" Label="Refresh" HorizontalAlignment="Left" Margin="155,178,0,0" VerticalAlignment="Top"/>
<TextBlock x:Name="timerLabel" HorizontalAlignment="Left" Text="00:00:00" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="72" FontWeight="Normal" TextAlignment="Center" Width="328" Margin="272,90,0,0"/>
<Button Name="startButton" Background="MediumSeaGreen" Foreground="White" Content="Start" HorizontalAlignment="Left" Click="Button_Click_Start" VerticalAlignment="Top" Margin="311,219,0,0"/>
<Button Name="stopButton" Background="MediumSeaGreen" Foreground="White" Content="Pause" HorizontalAlignment="Left" Click="Button_Click_Pause" VerticalAlignment="Top" Margin="398,219,0,0" RenderTransformOrigin="1.373,0.57"/>
<Button Name="resetButton" Background="MediumSeaGreen" Foreground="White" Content="Reset" HorizontalAlignment="Left" Click="Button_Click_Reset" VerticalAlignment="Top" Margin="498,219,0,0" RenderTransformOrigin="1.373,0.57"/>
<Button Name="restButton" Content="Parametres" HorizontalAlignment="Left" Click="Button_Click_Rest" VerticalAlignment="Top" Margin="698,192,0,0" RenderTransformOrigin="1.373,0.57"/>
<TextBlock Name="Round" Text="Nombre Round" HorizontalAlignment="Left" Height="20" Margin="382,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="140" TextDecorations="Underline"/>
</RelativePanel>
</Grid>
</RefreshContainer>
I expect the app data to refresh
Refresh Button UWP
I tested your code, the problem is you have not set a scroll-able control as RefreshContainer's content. Base on #Stuart Smith provided document, you could realize refresh feature, before that you need place the above Grid content under the ScrollViewer.
Xaml
<RefreshContainer Name="MyRefreshContainer" RefreshRequested="MyRefreshContainer_RefreshRequested">
<ScrollViewer>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="910" Height="383" Margin="0,0,0,0">
<RelativePanel
HorizontalAlignment="Center" BorderBrush="DarkOliveGreen" BorderThickness="8" Background="FloralWhite" Height="356" VerticalAlignment="Center" Width="871" Margin="0,0,0,0" Visibility="Visible" RequestedTheme="Default">
<AppBarButton x:Name="RefreshButton" Click="RefreshButtonClick"
Icon="Refresh" Label="Refresh" HorizontalAlignment="Left" Margin="155,178,0,0" VerticalAlignment="Top"/>
<TextBlock x:Name="timerLabel" HorizontalAlignment="Left" Text="00:00:00" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="72" FontWeight="Normal" TextAlignment="Center" Width="328" Margin="272,90,0,0"/>
<Button Name="startButton" Background="MediumSeaGreen" Foreground="White" Content="Start" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="311,219,0,0"/>
<Button Name="stopButton" Background="MediumSeaGreen" Foreground="White" Content="Pause" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="398,219,0,0" RenderTransformOrigin="1.373,0.57"/>
<Button Name="resetButton" Background="MediumSeaGreen" Foreground="White" Content="Reset" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="498,219,0,0" RenderTransformOrigin="1.373,0.57"/>
<Button Name="restButton" Content="Parametres" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="698,192,0,0" RenderTransformOrigin="1.373,0.57"/>
<TextBlock Name="Round" Text="Nombre Round" HorizontalAlignment="Left" Height="20" Margin="382,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="140" TextDecorations="Underline"/>
</RelativePanel>
</Grid>
</ScrollViewer>
</RefreshContainer>
Code behind
private void RefreshButtonClick(object sender, RoutedEventArgs e)
{
MyRefreshContainer.RequestRefresh();
}
private async void MyRefreshContainer_RefreshRequested(RefreshContainer sender, RefreshRequestedEventArgs args)
{
using (var RefreshCompletionDeferral = args.GetDeferral())
{
// Do some async operation to refresh the content
RefreshCompletionDeferral.Complete();
RefreshCompletionDeferral.Dispose();
}
}
Tomas, I see you've abandoned the refresh button for now, but I wanted to follow up in case you revisit this later or if others run into this issue in the future.
In order for the data to refresh, you'd need to code this in.
“To get fresh content when needed, handle the RefreshRequested event. In the event handler, you'll need code specific to your app to get the fresh content.” https://learn.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/pull-to-refresh#handle-a-refresh-request. There's a sample in the doc there too.
You'd typically use data binding for this and the RefreshRequested event would need to edit the bound object.
using (var RefreshCompletionDeferral = args.GetDeferral())
{
await FetchAndInsertItemsAsync(3);
}
In the sample, you'll notice that FetchAndInsertItemsAsync is inserting new items to the backing collection.
There's more info on data binding here: https://learn.microsoft.com/en-us/windows/uwp/data-binding/data-binding-quickstart
I am new to WPF,and have written a simple hello world type application in order to get started. The code I have so far is shown below:
WPF XAXML
<Window x:Name="wndMain" x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ews="clr-namespace:ExtraWindowStyles"
ResizeMode="NoResize"
ews:ExtraWindowStyles.CanMinimize="false"
ews:ExtraWindowStyles.CanMaximize="false"
Title="Hello World" Height="501.492" Width="842.285">
<Grid>
<GroupBox Header="Input Parameters" HorizontalAlignment="Left" Height="173" Margin="10,25,0,0" VerticalAlignment="Top" Width="801" >
<StackPanel Orientation="Horizontal" Margin="0,0,96,0">
<StackPanel Margin="10">
<Label FontWeight="Bold">First Group</Label>
<RadioButton x:Name="opt11">Option 1 - 1</RadioButton>
<RadioButton x:Name="opt12">Option 1 - 2</RadioButton>
<RadioButton x:Name="opt13">Option 1 - 3</RadioButton>
</StackPanel>
<StackPanel Margin="10">
<Label FontWeight="Bold" Content="Second Group"/>
<RadioButton x:Name="opt21" Content="Option 2 - 1"/>
<RadioButton x:Name="opt22" Content="Option 2 - 2"/>
<RadioButton x:Name="opt23" Content="Option 2 - 3"/>
</StackPanel>
</StackPanel>
</GroupBox>
<Separator HorizontalAlignment="Left" Height="80" Margin="17,203,0,0" VerticalAlignment="Top" Width="794"/>
<Button x:Name="btnSubmit" Content="Submit" HorizontalAlignment="Left" Height="34" Margin="632,203,0,0" VerticalAlignment="Top" Width="179" Click="btnExplore_Click" />
<Label Content="Results:" HorizontalAlignment="Left" Height="28" Margin="10,242,0,0" VerticalAlignment="Top" Width="161"/>
<Label Content="My App" HorizontalAlignment="Left" Height="23" Margin="696,439,0,0" VerticalAlignment="Top" Width="130" FontSize="9"/>
<TextBlock>
<Hyperlink NavigateUri="http://www.google.com" RequestNavigate="Hyperlink_RequestNavigate">
Click Here
</Hyperlink>
</TextBlock>
<Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="162" Margin="17,270,0,0" Stroke="Black" VerticalAlignment="Top" Width="794"/>
<Label x:Name="lblResult" Content="" HorizontalAlignment="Left" Height="157" Margin="17,275,0,0" VerticalAlignment="Top" Width="794"/>
</Grid>
</Window>
Code Behind..
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
If I comment out the Hyperlink control XAML (and its related backend code), I am able to select options, click the Submit button etc.
However, if I uncomment the Hyperlink control (and its associated backend code), The only thing that remains clickable, is the Url on the form - what's going on?
Just position your TextBlock and it won't take all space in the window and cover everything :
<TextBlock Width="100" Height="30">
<Hyperlink Background="Red" NavigateUri="http://www.google.com" >
Click Here
</Hyperlink>
</TextBlock>
Because the TextBlock is after submit button in XAML it is over.
You could also set Margin to position the TextBlock
Layout knowledge
Elements in a grid Stretch Horizontally and Vertically if no alignment is set.
Useful tip : If you click on the TextBlock tag, you'll see the extent of the TextBlock in the design view.
Often useful
I've got a custom set of controls:
<Border Height="55" Margin="5,14,5,0" VerticalAlignment="Top" BorderThickness="1" BorderBrush="Black">
<Grid>
<TextBlock x:Name="SubjectNo" Text="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="36" Margin="0,1,36,0" d:LayoutOverrides="HorizontalAlignment" />
<TextBlock x:Name="Subject" Text="Subject NAME more " TextWrapping="Wrap" FontSize="24" FontWeight="Bold" Margin="26,0,90,19" d:LayoutOverrides="Height, TopPosition, BottomPosition" />
<TextBlock x:Name="Teacher" Text="BIG NAME HERE" TextWrapping="Wrap" FontSize="14.667" VerticalAlignment="Bottom" Margin="26,0,0,9" HorizontalAlignment="Left" Width="106" Height="17" d:LayoutOverrides="VerticalAlignment" />
<Grid Height="15" VerticalAlignment="Bottom" Margin="133,0,0,10" d:LayoutOverrides="VerticalAlignment">
<TextBlock x:Name="BegTime" Text="12:55 AM" TextWrapping="Wrap" FontSize="13.333" d:LayoutOverrides="Height, TopPosition, BottomPosition" SelectionHighlightColor="White" Margin="8,0,-8,0" />
<TextBlock x:Name="EndTime" Text="12:55 PM" TextWrapping="Wrap" FontSize="13.333" Margin="68,0,-12,0" d:LayoutOverrides="HorizontalAlignment, Height, TopPosition, BottomPosition" />
<TextBlock x:Name="Line" Text="-" TextWrapping="Wrap" FontSize="13.333" Margin="64,0,0,0" d:LayoutOverrides="Height, TopPosition, BottomPosition" />
</Grid>
<Border Margin="281,4,10,6" BorderBrush="Black" BorderThickness="1" d:LayoutOverrides="TopPosition, BottomPosition" HorizontalAlignment="Center" Width="57">
<Grid>
<TextBlock x:Name="RoomNo" Text="1255" TextWrapping="Wrap" FontSize="24" d:LayoutOverrides="HorizontalAlignment, Width, TopPosition, BottomPosition" Margin="2,10,-2,0" />
<TextBlock x:Name="RoomWritten" Text="Room" TextWrapping="Wrap" FontSize="14.667" VerticalAlignment="Top" HorizontalAlignment="Stretch" d:LayoutOverrides="HorizontalAlignment, Width" Margin="9,0,4,0"/>
</Grid>
</Border>
<AppBarButton x:Name="appBarButton" Label="" Margin="158,0" VerticalAlignment="Bottom" Width="32" HorizontalAlignment="Stretch" Icon="Remote" Height="13" d:LayoutOverrides="VerticalAlignment"/>
</Grid>
</Border>
It looks like this
Now I want to add a button like this to make my control show additional info in the bottom, so I want it to expand from the bottom and show additional textblock, like windows 10 notification center does. Than the icon changes and when I press the button again, additional info hides. Can anybody help me?
The type of control you are looking for is called a ToggleButton. It has an IsChecked state property to facilitate the two states for your "open" and "closed". The logic and styling for what is displayed by you when IsChecked is true or false can be controlled via styles.
More information on MSDN: ToggleButton class
Ok I have been working on an app for awhile now this is my first windows phone app I have made and I have been running into a problem. The way I designed my app is my start page is a hub control and I have two textboxs and a date picker on each page and some other controls. Now what I want to do is when I press the add button on a given section then I want to take all the strings from my various controls and add it to a textfile that I will later use. My problem is when I make the event for the button I cannot access the controls because they are inside the hubs data template. I have looked a many other examples on how to get around this they just dont seem to work and I cant make sense of them. So if anyone on here has the patience to kinda step me through the process that would be wonderful. Thank you for any help.
<Page.Resources>
<DataTemplate x:Key="DataTemplate1">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="85,7,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" FontSize="21.333"/>
<TextBox x:Name="tbHours" LostFocus="tbHours_LostFocus" HorizontalAlignment="Left" Margin="0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" hrs" Width="80"/>
<TextBox x:Name="tbMinutes" LostFocus="tbMinutes_LostFocus" HorizontalAlignment="Left" Margin="95,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" min" Width="80"/>
<TextBlock HorizontalAlignment="Left" Margin="0,50,0,0" TextWrapping="Wrap" Text="Work date" VerticalAlignment="Top" FontSize="14.667"/>
<DatePicker LostFocus="DatePicker_LostFocus" HorizontalAlignment="Left" Margin="0,65,0,0" VerticalAlignment="Top" Width="127"/>
<AppBarButton x:Name="abtnAddHours" HorizontalAlignment="Left" Icon="Add" Label="" Margin="118,65,0,0" VerticalAlignment="Top" Click="abtnAddHours_Click"/>
</Grid>
</DataTemplate>
<DataTemplate x:Key="DataTemplate2">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="0,7,0,0" TextWrapping="Wrap" Text="$" VerticalAlignment="Top" FontSize="21.333"/>
<TextBox x:Name="tbExpenses" LostFocus="tbExpenses_LostFocus" HorizontalAlignment="Left" Margin="15,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" 0.00" Width="100"/>
<TextBlock HorizontalAlignment="Left" Margin="0,45,0,0" TextWrapping="Wrap" Text="Expense date" VerticalAlignment="Top" FontSize="14.667"/>
<DatePicker x:Name="dtpkrExpenses" LostFocus="dtpkrExpenses_LostFocus" HorizontalAlignment="Left" Margin="0,60,0,0" VerticalAlignment="Top" Width="115"/>
<TextBlock HorizontalAlignment="Left" Margin="0,115,0,0" TextWrapping="Wrap" Text="Expense notes" VerticalAlignment="Top" FontSize="14.667"/>
<TextBox x:Name="tbNotes" LostFocus="tbNotes_LostFocus" HorizontalAlignment="Left" Margin="0,140,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200"/>
<AppBarButton x:Name="abtnAddExpense" HorizontalAlignment="Left" Icon="Add" Label="" Margin="193,128,0,0" VerticalAlignment="Top"/>
</Grid>
</DataTemplate>
<DataTemplate x:Key="DataTemplate3">
<Grid>
<TextBlock HorizontalAlignment="Left" Margin="0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="14.667" Text="Working hour rate" Height="20"/>
<TextBlock HorizontalAlignment="Left" Margin="0,32,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="21.333" Text="$"/>
<TextBox x:Name="tbWage" LostFocus="tbWage_LostFocus" HorizontalAlignment="Right" Margin="0,25,237,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" InputScope="Number" PlaceholderText=" 0.00" Width="89"/>
<AppBarButton x:Name="abtnAddWage" HorizontalAlignment="Left" Icon="Add" Label="" Margin="92,14,0,0" VerticalAlignment="Top"/>
</Grid>
</DataTemplate>
</Page.Resources>
<Page.BottomAppBar>
<CommandBar ClosedDisplayMode="Compact">
<CommandBar.SecondaryCommands>
<AppBarButton Label="Reset"/>
</CommandBar.SecondaryCommands>
<AppBarButton x:Name="abtnSummary" Icon="List" Label="Summary" Click="abtnSummary_Click"/>
</CommandBar>
</Page.BottomAppBar>
<Grid>
<Hub x:Name="Hub" Header="Hours+" Background="{ThemeResource PhoneAccentBrush}">
<HubSection x:Name="sctnAddHours" Header="Add hours" ContentTemplate="{StaticResource DataTemplate1}"/>
<HubSection x:Name="sctnAddExpenses" Header="Add expenses" ContentTemplate="{StaticResource DataTemplate2}"/>
<HubSection x:Name="sctnWage" Header="Wage" Height="580" ContentTemplate="{StaticResource DataTemplate3}"/>
</Hub>
</Grid>
Use the Loaded event of the control you want to access and assign it to a local variable like this.
XAML
<AppBarButton x:Name="abtnAddHours" Loaded="abtnAddHours_Loaded" HorizontalAlignment="Left" Icon="Add" Label="" Margin="118,65,0,0" VerticalAlignment="Top" />
Code Behind
//local variable
private TextBlock _abtnAddHours;
//Loaded event of the TextBlock from the template
private void abtnAddHours_Loaded(object sender, RoutedEventArgs e)
{
_abtnAddHours = (TextBlock)sender;
//Add the event handler for the Click event
_abtnAddHours.Click += _abtnAddHours_Click;
}
private void _abtnAddHours_Click(object sender, RoutedEventArgs e)
{
//Put your logic here
}
I'm creating an app who is a list of choices. For the 3 first choices I want to put 3 images an bellow them 3 radiobutton.
but it only show images when I write :
<Grid>
<Image x:Name="sinus" Source="C:\Users\Maximilien\Documents\BFH\HBridge\HBridge\Resources\sin1.bmp" HorizontalAlignment="Left" Height="100" Margin="120,80,0,0" VerticalAlignment="Top" Width="120" Stretch="Fill" />
<Image x:Name="triangle" Source="C:\Users\Maximilien\Documents\BFH\HBridge\HBridge\Resources\tri1.bmp" HorizontalAlignment="Left" Height="100" Margin="320,80,0,0" VerticalAlignment="Top" Width="120" Stretch="Fill" />
<Image x:Name="continue" Source="C:\Users\Maximilien\Documents\BFH\HBridge\HBridge\Resources\cont1.bmp" HorizontalAlignment="Left" Height="100" Margin="520,80,0,0" VerticalAlignment="Top" Width="120" Stretch="Fill" />
<RadioButton x:Name="sinus_checkbox" HorizontalAlignment="Left" Margin="173,200,0,0" VerticalAlignment="Top" Cursor="Hand" ToolTip="Tension Sinusoïdale" IsChecked="True"/>
<RadioButton x:Name="triangle_checkbox" HorizontalAlignment="Left" Margin="373,200,0,0" VerticalAlignment="Top" Cursor="Hand" ToolTip="Tension Triangulaire"/>
<RadioButton x:Name="continue_checkbox" HorizontalAlignment="Left" Margin="573,200,0,0" VerticalAlignment="Top" Cursor="Hand" ToolTip="Tension Continue"/>
but when I send the .exe to a friend the 3 images wouldn't display..
I've tried this :
<Grid>
<Image x:Name="sinus" Source="pack://siteoforigin:,,,/Resources/sin1.bmp" HorizontalAlignment="Left" Height="100" Margin="120,80,0,0" VerticalAlignment="Top" Width="120" Stretch="Fill" />
<Image x:Name="triangle" Source="pack://siteoforigin:,,,/Resources/tri1.bmp" HorizontalAlignment="Left" Height="100" Margin="320,80,0,0" VerticalAlignment="Top" Width="120" Stretch="Fill" />
<Image x:Name="continue" Source="pack://siteoforigin:,,,/Resources/cont1.bmp" HorizontalAlignment="Left" Height="100" Margin="520,80,0,0" VerticalAlignment="Top" Width="120" Stretch="Fill" />
<RadioButton x:Name="sinus_checkbox" HorizontalAlignment="Left" Margin="173,200,0,0" VerticalAlignment="Top" Cursor="Hand" ToolTip="Tension Sinusoïdale" IsChecked="True"/>
<RadioButton x:Name="triangle_checkbox" HorizontalAlignment="Left" Margin="373,200,0,0" VerticalAlignment="Top" Cursor="Hand" ToolTip="Tension Triangulaire"/>
<RadioButton x:Name="continue_checkbox" HorizontalAlignment="Left" Margin="573,200,0,0" VerticalAlignment="Top" Cursor="Hand" ToolTip="Tension Continue"/>
But with that , the 3 images won't even display on my PC and in the debug I got something like : Cannot find a part of the path 'C:\Users\Maximilien\Documents\BFH\HBridge\HBridge\bin\Debug\Resources\sin1.bmp'.
Maybe it's a problem with Ressources but I've set thoses images in the .resx
Thank for answer , I use VS2012 ultimate
Sorry for my english
P.S : some screen :
http://i.stack.imgur.com/8qM82.png
.rar of my project :
http://www.partage-facile.com/V0SQ3J1CU7/hbridge.rar.html
You can try using relative path (relative to your project folder) instead of absolute path like C:\... Assuming that your project folder is C:\Users\Maximilien\Documents\BFH\HBridge\HBridge, this is the relative path to your images :
<Image x:Name="sinus" Source="Resources\sin1.bmp" ..... />
<Image x:Name="triangle" Source="Resources\tri1.bmp" ..... />
<Image x:Name="continue" Source="Resources\cont1.bmp" ..... />
you can also rely on Visual Studio's intellisense to get the correct relative path. When typing Source="" in XAML, with cursor positioned between double-quotes press CTRL+SPACE, dropdown will appear suggesting available paths (tested in VS2012 here)