I try to migrate my Windows 8.1 application to Windows 10 Mobile (SDK 10240),
But the Hub control doesn't work like in Windows Phone 8.1.
The hub sections are too small or big and don't fit the mobile screen width.
I didn't find any property to solve the problem.
<Hub Background="White" Header="Header">
<HubSection x:Uid="HubSection1" Header="Header1">
<DataTemplate>
<TextBlock Text="Content1" />
</DataTemplate>
</HubSection>
<HubSection x:Uid="HubSection2" Header="Header2" >
<DataTemplate>
<TextBlock Text="Content2" />
</DataTemplate>
</HubSection>
</Hub>
I want it like in Windows Phone 8.1 that the Header1 is in the first page, Header2 in the second, etc...
I created this Behavior to make the Hub control behave like the Windows Phone 8.1 control when running on mobile.
Check it out and tell me if it fixes your problem.
Related
I have a hyperlink inside a Text block. I want it to open the link int he web browser, but when I Click it I get a popup saying
"Search an app in the store"
and my app crashes.....
my XAML code is:
<TextBlock HorizontalAlignment="Right" Height="49" Margin="0,0,10,0" TextWrapping="Wrap" Width="326" Foreground="Black" FontSize="16">
<TextBlock.Inlines>
<Hyperlink Click="Hyperlink_Click" NavigateUri="www.bing.com">
<Hyperlink.Foreground>
<ImageBrush Stretch="Fill" ImageSource="Assets/Proceed.png"/>
</Hyperlink.Foreground>Don't have a Selfcare Account ? Register here.</Hyperlink>
</TextBlock.Inlines>
<!--<Hyperlink xml:space="preserve" Foreground="#000" FontSize="16">Don't have a Mobitel Selfacre Account ? Register here. </Hyperlink>-->
</TextBlock>
my CS code is:
private async void Hyperlink_Click(Windows.UI.Xaml.Documents.Hyperlink sender, Windows.UI.Xaml.Documents.HyperlinkClickEventArgs args)
{
await Launcher.LaunchUriAsync(new Uri("www.google.com"));
}
Kindly help me fix it... Any kind of help is appreciated....
Change the uri from www.bing.com to http://www.bing.com. It needs the protocol to determine the application it uses to start the url with.
Check these links for more information:
Auto-launching apps using file and URI associations for Windows Phone 8
URI schemes for launching built-in apps for Windows Phone 8
Reserved file and URI associations for Windows Phone 8
I've just moved from Windows Phone 8.1 Silverlight to Windows Phone Store apps. I've the following XAML for an app page:
<Page
x:Class="WebClip.HubPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WebClip"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:data="using:WebClip.Data"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot">
<Hub x:Name="Hub"
Header="web clip"
Background="{ThemeResource HubBackgroundImageBrush}">
<HubSection x:Name="TileSelectorView"
Header="TILE SELECTOR">
<DataTemplate>
<ListView x:Name="TileList"/>
</DataTemplate>
</HubSection>
<HubSection x:Name="BrowserView"
Header="BROWSER">
<DataTemplate>
<WebView x:Name="BrowserBox"/>
</DataTemplate>
</HubSection>
</Hub>
</Grid>
</Page>
Earlier, in Silverlight, I can access an element like TileList directly to do something like:
TileList.ItemsSource = <SomeItemSourceList>;
But now I'm unable to do that in the backend C# code. The TileList in itself is not accessible. However, TileSelectorView and BrowserView (ref: code above) are accessible.
I found these two questions where Jerry had answered to something similar:
How to accessing Elements in XAML DataTemplate Listview without interacting with it
How do I access a control inside a XAML DataTemplate?
However, I'm not able to replicate them. There is no Items property under my TileSelectorView to iterate through.
What am I doing wrong? How do I get about this?
I ran into the same issue when moving from windows Phone Silverlight to Windows Phone RT. You can get around this issue by data binding as the others suggested but sometime you want to just get the control on the page. I found the following article quite helpful..
Get the controls inside DataTemplate control
you can databind them like this:
I've just moved from Windows Phone 8.1 Silverlight to Windows Phone Store apps. I've the following XAML for an app page:
<HubSection x:Name="TileSelectorView"
Header="TILE SELECTOR"
ItemsSource="{Binding SomeItemSourceList}">
<DataTemplate>
<ListView x:Name="TileList"/>
</DataTemplate>
</HubSection>
this assumes you are using the MVVM pattern which is a best practice when developing Windows Phone apps
https://msdn.microsoft.com/en-us/library/windows/apps/jj883732.aspx
personally i prefer MVVM Light as my MVVM framework:
http://blog.galasoft.ch/posts/2014/04/building-a-universal-application-for-windows-phone-8-1-and-windows-8-1-with-mvvm-light/
I'm trying to make an image gallery from pictures library images. Everything is working fine when I have a reduced number of images, but if I have more than 80 images, the phone runs out of memory. I've tried using data virtualization by defining a class which implements the ISupportIncrementalLoading interface. Then I used that class to populate my GridView, but with absolutely no luck: it still is throwing an OutOfMemoryException.
The possibility I'm thinking about is to use random access virtualization, but I haven't found any code template about it.
So,
Could you please explain me how to apply random access virtualization to my list of images?
Or
Could you please explain me how to effectively make an image gallery which retrieves its elements from the Phone's photo gallery?
My XAML code is as follows:
<GridView x:Name="photosGrid" Height="392" Width="400" ItemsSource="{Binding}" Margin="0,0,-0.333,0" SelectionMode="Multiple" Background="Black">
<GridView.ItemTemplate>
<DataTemplate>
<Image Width="90" Height="90" Margin="5" Source="{Binding}" Stretch="UniformToFill"/>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
I can't get the ToggleSwitch control to appear in my Windows Phone app. The code I'm trying to use is:
<toolkit:ToggleSwitch Header="ToggleSwitch" Height="111" HorizontalAlignment="Left" Margin="7,397,0,0" Name="toggleSwitch1" VerticalAlignment="Top" Width="456" />
or
<controls:ToggleSwitch Header="Test">
<controls:ToggleSwitch.HeaderTemplate>
<DataTemplate>
<ContentControl Content="{Binding}" Foreground="Red"/>
</DataTemplate>
</controls:ToggleSwitch.HeaderTemplate>
</controls:ToggleSwitch>
Neither of which work, and I can't figure out why. It's a C# app that I'm working with.
I think it has to b e a Silverlight app for this to work. Not sure why. I just used a checkbox instead.
How to change the theme of application if the system theme has been change in Windows Phone 7 if application in Runing?
The system theme applies throughout all apps. So if system them changes and you have used one of the system defined colors/ fonts, etc in your app, the app will automatically start using the new theme colors/ fonts.
So for eg: in your app, if you have:
<TextBlock x:Name="ApplicationTitle" Text="My App Title" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Page Title" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
here "StaticResource PhoneTextNormalStyle" specifies that you are using this system defined style. Now when user changes their system theme, this will automatically change colors in your app. also.
See http://msdn.microsoft.com/en-us/library/ff769545(v=vs.92).aspx