Implement search interface Windows Phone - xaml

I was looking around, but couldn't find a good reference for how to implement the search overlay for windows phone applications. I want to emulate how search is implemented in the store, music, and other system type applications.
I have the application bar created with the icon, but not sure what is happening when the button is clicked. It appears that some overlay is transitioned in on top of the page. I can emulate this, but since this seems like such a common scenario, I hoped there would be a guide to enable consistent experience across applications.
Application bar with search button: https://skydrive.live.com/redir?resid=1EBF644EEFCAD766!25155&authkey=!AB2pGcqFd9jo4JE
Overlay: https://skydrive.live.com/redir?resid=1EBF644EEFCAD766!25156&authkey=!ALmHpcgyqYyvBfU

There is no official control that does that for you. In my applications I do the following for covering this scenario:
1 - Add search button to application bar
2 - When button is clicked, navigate to a new page (eg. SearchPage.xaml):
NavigationService.Navigate(new Uri("/SearchPage.xaml", UriKind.Relative));
3 - Set focus to the search box in the Loaded event on that page to open the keyboard (doing it in OnNavigatedTo for example will not work):
mySearchTextbox.Focus();
4 - Use the Silverlight Toolkit for Windows Phone to add transitions from/to the page. I use the following animations, which creates a very similair animation style to the built in search pages:
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Forward>
<toolkit:SlideTransition Mode="SlideUpFadeIn" />
</toolkit:NavigationInTransition.Forward>
<toolkit:NavigationInTransition.Backward>
<toolkit:SlideTransition Mode="SlideUpFadeIn" />
</toolkit:NavigationInTransition.Backward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:SlideTransition Mode="SlideDownFadeOut" />
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:SlideTransition Mode="SlideDownFadeOut" />
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>

Related

The default out-of-the box template for Blazor doesn't work on mobile

If I create a new Blazor application (Server-side or WASM), the default template that is provided with the Counter and Fetch Data menu items doesn't work properly on a mobile device. It run's ok on a desktop browser. Is there something setup incorrectly?
On the mobile, the menu never opens. The hamburger Menu button cannot be tapped. Apart from that, if you manage to navigate by URL to another page, the page keep loading without giving any error.

How can I disable the mobile theme for a single page?

I recently uploaded custom html and css for one page on my big commerce store.The page is responsive, and mobile optimized. It works on desktops, but is over ridden by the generic mobile theme that is installed when I view it on my phone. How can I stop this page from being over ridden by the mobile version, without disabling the mobile theme completely?
Thanks,
There are 2 methods off the top of my head.
First method
Any HTML file on BigCommerce, with a mobile/responsive theme, has 2 copies of some part of the HTML page. The mobile HTML/CSS is simply triggered by an HTML class mobile on the HTML copy that is there to be only seen on mobile, which contains one copy of relevant HTML (ie, menus, logo, shopping cart icon and link, etc).
Another HTML block has class desktop and is only triggered for certain screen sizes (similar to mobile), and only shows it's desktop version of the HTMl when the screen size conditions are met.
So if screen is small, in your responsive.css file, .mobile is display:none;, while desktop class has all the proper visible CSS.
On the reverse, on desktop-sized screens, the desktop HTML is properly styled, while the mobile class HTML block is display:none.
So, in this first solution, you would simply place a copy of your custom HTMl and style it properly for display on mobile screens. This way, the mobile-styled version will only show up on mobile devices, while the desktop properly-styled version will only show up on dektop size screens. As far as BC goes, I think this is the optimal method.
Second method
You can make a custom template for the page in question. So if it's product.html and you want it custom for some specific product(s), you would create a product-custom.html and place it in your WebDav "/template/Panels" folder.
Now, on your product(s) which must use the new custom HTML, go to their page and scroll to the bottom and you will see a template file selection box, which should say product.html. Change that to your new product-custom.html.
Now, as for the custom file, simply edit the HTML/CSS rules revolving around .desktop and .mobile class (possibly just removing them all together) so that when a page is loaded on a small screen, the CSS rule to hide the desktop version won't apply. At the same time, you should delete the duplicate .mobile class HTML as it will no longer be needed.
This second method is much more flexible but also takes more work and is generally much more messy and requires much more maintenance.
I strongly recommend method #1.
Let me know if this helps and if you have nay other questions.

Window phone - How to appear SlideView in specific page?

I'm create slide menu as Facebook,and I'm follow this https://slideview.codeplex.com/ . And I have xaml code as below :
<Application.RootVisual>
<library:SlideApplicationFrame Title="Slide View">
<library:SlideApplicationFrame.LeftContent>
<pages:LeftView />
</library:SlideApplicationFrame.LeftContent>
<library:SlideApplicationFrame.RightContent>
<pages:RightView />
</library:SlideApplicationFrame.RightContent>
</library:SlideApplicationFrame>
My problem is : Slide menu will be apply all page,but I want slide is appear in specific page .
You can implement that by either Control animation while navigating between panes inside a Windows Phone page or Add side menus to an Windows Phone application (similar to the Facebook app)
Write the following lines of code in the constructor of page in which you want to hide slide view.
SlideView.Library.SlideApplicationFrame.SetHideHeader(App.RootFrame, false);
App.RootFrame.IsSlideEnabled =false;
App.RootFrame.ToggleHeaderVisibility(false);

WinRT XAML Toolkit preloaded pages

I have a question to creator of WinRT XAML Toolkit that had helped me a lot.
What is the best mechanism for working with rich pages in WinRT?
These are the conditions:
There are about 2 pages that have a lot of elements and some high resolution images in the background. Obviously they consume time to load their content. That's why I use AlternativeFrame.Preload() method from the Toolkit.
Also these pages are the most frequently used.
That's why I stand before choosing to either constantly preload these pages (create, draw, fill) but when it is needed or creating my own page cache that would store them (maybe I am blind and the Toolkit already has this functionality?).
Can you advise what's the best practice in this problem and whether maybe there's a third way?
To add some more background - the WinRT XAML Toolkit library has two controls: AlternativeFrame and AlternativePage that are alternate implementations of the base Frame and Page classes that come out of the box in Windows 8 SDK for dealing with UI navigation - similar to how you navigate pages in a web browser. The API of these alternative controls is almost the same as in the base ones, but it adds some more support for asynchronous development model, page transition animations and preloading pages before they are requested.
Currently the Preload() method preloads a page of a given type in the background and puts it in a cache and when a Navigate() method is invoked to navigate to the page of that type - instead of instantiating a new page - the one in the cache is used, so it can immediately be shown, but also - the cache gets emptied and the next time you want to navigate to that same page - you need to preload it again. This works well if you don't return to the preloaded page often and the page uses a lot of memory, but if you want to keep that page in cache - there is not built-in support for that. The original Page class has a NavigationCacheMode property that allows to configure a page to be kept in cache once it is loaded the first time and it would be a good option for you, but AlternativePage doesn't have that support yet. I am thinking about adding it there today since I have some free time, so you might decide to wait for me to do it. Other options include
displaying your page on top of the navigation frame instead of navigating to it in the frame - then you could simply show/hide it when needed
or you can switch back to the standard Frame/Page controls and set NavigationCacheMode="Required" on your Page so it stays in memory forever, though you do lose the Preload() feature then.
or you can modify the Toolkit yourself
or you can cache the content of your page yourself - simply save the Content of your page in some sort of cache (e.g. a Dictionary<Type,UIElement> that maps page type to content) and remove it from the page (set Content to null) when you navigate away from the page and then add it back to the page when you navigate to it and the content is found in the cache. In that case you would probably want to make the Content be a separate UserControl and skip calling InitializeComponent() in the constructor if you retrieve the content from the cache since you can only have one Content and having it defined in a separate UserControl will allow you to get auto-generated code that gets executed in InitializeComponent() that grants you easy access to named elements, registers event handlers etc.

Creating a Logon Screen

What is the best way to make password/logon screen? Iread somewhere that it is better to use a popup control. If so where exactly do I need to create it, in App.xaml?
There are number of things you need to consider while implementing a login screen for your Windows Phone 7 application. Here is a sample that can give you an idea of how to get started, if you haven't. One of the important aspects of a login screen is its appearance on the "back stack" - the list that grows while you are within your application, each item in this list is accessible through the "back" button. Ideally, you wouldn't want the user to press the back button and view the login screen. In other words, the login screen should never be in the "back stack". Therefore, it is probably best to implement the login screen as popup, see Peter Torr's post discussing this.
Peter Torr published an article on "Places" which could help you design your application with the login screen.
Regarding implementation of a popup, I posted a simple example in the Answer linked below which you can check out. In this case it implements a context menu.. you can populate the popup with whichever contents make sense for your login screen.
http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/e6d2a444-91d9-4d69-937e-689b24c36c09
I recommend reading the two links Indyfromoz has hooked you up with for how to handle a login screen wrt the navigation service. This are the most relevant and the current posts on the topic of handling login screens and the like wrt the navigation service.