drill down windows phone - xaml

I created a chart in windows phone app using AmChart.I want to put the select value in the chart in a textbox How Can I do this?
This my code (Xaml) so far:
<!--ContentPanel - placez tout contenu supplémentaire ici-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<amq:SerialChart x:Name="MainPage1" DataSource="{Binding Data}" CategoryValueMemberPath="axis"
AxisForeground="White"
PlotAreaBackground="Black"
GridStroke="DarkGray" >
<amq:SerialChart.Graphs>
<amq:ColumnGraph ValueMemberPath="value" Title="Column #2" Brush="#8000FF00" ColumnWidthAllocation="0.4" />
</amq:SerialChart.Graphs>
</amq:SerialChart>
<amq:PieChart x:Name="Pie" DataSource="{Binding Data}" TitleMemberPath="axis" ValueMemberPath="value"/>
<TextBox HorizontalAlignment="Left" Height="72" Margin="184,326,-184,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="456"/>
</Grid>
</phone:PhoneApplicationPage>

The following library allows you to create charts easily in Windows Phone..
Take a look over here

Related

Windows Phone StackPanel control alternative for Xamarin Forms?

I prototyped an app in Windows Phone 8.1 (WP) I was able to create cool controls using the which would allow me to put Labels and other controls inside a button and this would glue them all together.
I am now rebuilding the app in Xamarin.Forms (XF).
I am working around this issue for the time being in XF by using Absolute Layout but I fear and I am expecting this to fall apart over differnt phones, sizes and models.
I am certainly sure I am not the first to have this problem so I'm wondering how others have gotten around it.
Thank you :)
What I like doing in WP:
<Button Height="200" HorizontalAlignment="Left" Margin="232,1,0,0" Name="BtnVisitorScore" VerticalAlignment="Top" Width="220" Click="btnVisitorScore_Click" Grid.Row="1">
<StackPanel Margin="-5,-30,0,0" >
<TextBlock Text="{Binding MatchSettings.VisitingTeam.Name}" Height="40" HorizontalAlignment="Left" Width="180" FontSize="18" FontFamily="Arial" TextAlignment="Center" />
<TextBlock Text="{Binding VisitingTeamCurrentScore, StringFormat=N0}" Height="70" Width="180" FontSize="72" FontFamily="Arial" TextAlignment="Center" VerticalAlignment="Top" />
</StackPanel>
</Button>

How do I create a two column layout using xaml RelativePanel?

I'd really like to use RelativePanel in a UWP app I'm writing, to simplify visual state.
This is what I want
I've tried to achieve this with the following XAML:
<RelativePanel>
<TextBlock x:Name="Title" Height="50" Margin="15" FontSize="24"
RelativePanel.AlignTopWithPanel="True"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True">
</TextBlock>
<TextBox x:Name="Editor" Margin="15" Padding="20" HorizontalAlignment="Stretch"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.Below="Title"
RelativePanel.RightOf="FileList">
</TextBox>
<ListView x:Name="FileList" HorizontalAlignment="Stretch" Margin="15"
RelativePanel.AlignRightWithPanel="True"
RelativePanel.Below="Title">
</ListView>
</RelativePanel>
This isn't working. Editor does not stretch. If I set Editor to RelativePanel.AlignRightWith="FilesList", it stretches past files list and fills the window.
Is there any way to do what I want with RelativePanel? Please don't post suggestions on how to do this in Grid, I can already do that - I want to use RelativePanel in this case
Your Editor control should have -
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.Below="Title"
RelativePanel.LeftOf="FileList"
RelativePanel.AlignBottomWithPanel="True"
Note it should be LeftOf, not RightOf. You will also need AlignBottomWithPanel set to True.

How can I create a button "add an account" like in Windows Phone settings?

I'm new in developing applications for Windows Phone 8. I have a case that I need to add itens in a list, but I think will be nice if I could do something like the button "add an account", like in Windows Phone settings. See:
How can I do this?
I know how to do the accounts List. I can use LongListSelector, like this example:
<phone:LongListSelector x:Name="llsAccounts"
LayoutMode="List" Margin="0,150,0,0" SelectionChanged="llsAccounts_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="105" Width="432">
<!--Replace rectangle with image-->
<Border BorderThickness="1" Width="99" Height="99" BorderBrush="#FFFFC700" Background="#FFFFC700"/>
<StackPanel Width="311" Margin="8,-7,0,0">
<TextBlock Text="{Binding AccountName}" TextWrapping="Wrap" Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
<TextBlock Text="{Binding DetailsAccount}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource PhoneTextSubtleStyle}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
I could resolve my problem using two LongListSelectors: one LongListSelector only for the "add an account" item and the second LongListSelector for the all added accounts. But this will be messy for me... it's not the right way.
Thanks!
There are quite a few ways you can to do this. You can just add a static <StackPanel> for your Add an Account follow by the LLS. Or you can use the LLS header/footer tags.
LLS header/footer example:
<phone:LongListSelector Name="lls">
<phone:LongListSelector.ListHeader>
<TextBlock Text="this is a header"/>
</phone:LongListSelector.ListHeader>
<phone:LongListSelector.ListFooter>
<TextBlock Text="this is a footer"/>
</phone:LongListSelector.ListFooter>
</phone:LongListSelector>

How to access a control present inside a datatemplate of listbox in metro app?

I am developing a windows 8 metro app in which I have listbox which contains a set of textblocks and a Image.
<ListBox x:Name="lstbxbStudents" Background="Transparent" ItemContainerStyleSelector="{StaticResource ItemStyleSelector}" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemTemplate="{StaticResource LandscapeItemTemplate}" Height="476" SelectionChanged="lstbxbProducts_SelectionChanged_1" Style="{StaticResource ListBoxStyle1}" HorizontalAlignment="Left" Width="901">
</ListBox>
For that image ImgCmt I have set the source of the Image static inside the datatemplate of the listbox.
<Page.Resources>
<CollectionViewSource x:Name="cvs2" IsSourceGrouped="true" />
<!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
<x:String x:Key="AppName">Students Screen</x:String>
<DataTemplate x:Key="LandscapeItemTemplate" >
<StackPanel Orientation="Horizontal">
<StackPanel Width="30"></StackPanel>
<StackPanel Width="120" Orientation="Horizontal">
<TextBlock Text="{Binding stunum}" VerticalAlignment="Center" HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Width="350">
<TextBlock Text="{Binding studsc}" HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Width="10"></StackPanel>
<StackPanel Width="100">
<TextBlock Text="{Binding stuum}" x:Name="txtblkstuum" HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Width="150">
<TextBlock Text="{Binding stugrp}" VerticalAlignment="Center" TextAlignment="Right" HorizontalAlignment="Center" />
</StackPanel>
<StackPanel Width="100">
<TextBlock Text="{Binding stusection, Mode=TwoWay}" TextAlignment="Center" x:Name="txtbxbstusection" Tag="{Binding stunum}" VerticalAlignment="Center" HorizontalAlignment="Right" />
</StackPanel>
<StackPanel Width="50"></StackPanel>
<StackPanel>
<Image Source="Assets/comments.png" Name="ImgCmt" PointerPressed="Image_PointerPressed_1" VerticalAlignment="Center" Width="20" Height="20"></Image>
</StackPanel>
</StackPanel>
</DataTemplate>
</Page.Resources>
my objective is that I want to change the source of the image to different image source(change the image) in codebehind depnding upon some condition for that I need to access the control present inside a datatemplate of listbox in metro app ?
How can I do this :
How to access a control present inside a datatemplate of listbox in metro app?
What are the different ways in which I can do this?
How can I change the source of the image to different image source(change the image) in codebehind depending upon some condition?
This is a common question. We've all asked it at least once. The problem is that these controls don't have a unique name, because they are in a repeater. As a result, you cannot use the logical tree in XAML. The logical tree is what lets you call things by name. Instead, you need to use the visual tree in XAML. The visual tree is what lets you access everything on the screen including the dynamically rendered elements that adorn controls and populate repeaters. Because the visual tree is so big and because a repeater repeats, you still have to constrain the scope of the visual tree so you can reliably locate the control you want to find. I hope this makes sense.
Solution here: http://blog.jerrynixon.com/2012/09/how-to-access-named-control-inside-xaml.html

WinRT - XAML FlipView control - unusual new bahavior

I wonder if someone can help me with the FlipView control in windows 8. I have an app that uses a FlipView . Everything was working fine until a recent windows 8 update, and now the FlipView flips 'twice' in certain circumstances.
Here is some example XAML that reproduces the error:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<FlipView >
<Grid Height="762" Background="#FF29AA29">
<TextBlock HorizontalAlignment="Center" Text="1" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
<Grid Height="762" Background="#FF192780">
<TextBlock HorizontalAlignment="Center" Text="2" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
<Grid Height="762" Background="Green">
<TextBlock HorizontalAlignment="Center" Text="3" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
<Grid Height="762" Background="Orange">
<TextBlock HorizontalAlignment="Center" Text="4" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
<Grid Height="762" Background="Blue">
<TextBlock HorizontalAlignment="Center" Text="5" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
<Grid Height="762" Background="Red">
<TextBlock HorizontalAlignment="Center" Text="6" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
<Grid Height="762" Background="Yellow">
<TextBlock HorizontalAlignment="Center" Text="7" VerticalAlignment="Center"
Foreground="Black" FontSize="96"/>
</Grid>
</FlipView>
</Grid>
As you can see its a very simple example with numbered grids inside the FlipView.
Now, if you click on the forward or back flip buttons (slightly greyed out buttons on left and right sides) WITHOUT moving the mouse to a different location (i.e. move the mouse over the forward button and click multiple times without moving the mouse again) it will flip 1,2,4,6,7 (see numbers in my xaml).
If however you move the mouse slightly between clicks you get the correct behaviour (1,2,3,4,5,6,7).
This error exists in both local machine and emulator mode.
It doesn't happen when you use the finger drag method in the emulator to flip.
Does anyone have any ideas about how to fix this ?
It turns out the Windows 8 update I downloaded screwed the driver for my touchpad, and the issue is purely driver related - very weird though