How to position progressIndicator to center in windows phone? - c#

I am newbie to windows phone development.
I have created the progress indicator using following code .
ProgressIndicator progressIndicator = new ProgressIndicator();
progressIndicator.IsVisible = true;
progressIndicator.IsIndeterminate = true;
SystemTray.SetProgressIndicator(this, progressIndicator);
It is working fine. But it is coming in the top of display. I want to place it in center of display. How to do this ?

The Windows Phone SDK has an progress bar control which can be placed into any place of the page. But this control has weak performance to avoid this weakness you should use PerformanceProgressBar control from the Silverlight for Windows Phone

You can create a custom progress bar. That way you can define the control template as you would like. The following link should get you started:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg442303(v=vs.105).aspx
or you can override the control template of the standard ProgressIndicator, though I believe the performance of this control is quite poor.

Related

Icons in FreshTabbedNavigationContainer tabs bar are giant in IOS

I am trying to show 4 icons for 4 tabs in the bar of my FreshTabbedNavigationContainer using FreshMVVM and Xamarin.Forms of course, they look as they should when I execute the app on an Android emulator, but when I use my Mac and emulate the app on an IOS emulator, these icons become gargantuan, just as you see in this picture.
Here is my code:
FreshTabbedNavigationContainer Code:
private static FreshTabbedNavigationContainer TabbedPageContainer = null;
TabbedPageContainer = new FreshTabbedNavigationContainer(navigation.ToString());
Products = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconHomeInverted.ico", null);
Discover = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconMagnifyingGlassInverted.ico", null);
Account = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconUserInverted.ico", null);
Settings = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconSettingsInverted.ico", null);
#region UI
//Dissables swipe only in android because in IOS can not be done
TabbedPageContainer.On<Xamarin.Forms.PlatformConfiguration.Android>().SetIsSwipePagingEnabled(false);
TabbedPageContainer.BarTextColor = Color.FromHex("#FFFFFF");
#endregion
page.CoreMethods.SwitchOutRootNavigation(navigation.ToString());
My icons are located in "MyProject.IOS", they are not in the resources folder or anything like that.
That is all, if you need more information I will provide it as soon as I see your request. I hope all of you have a great day.
Ok, I solved it, my icons were 500x500 aprox, on Windows, visual studio or fresh MVVM resize the image to fill the tabbed bars; this does not happen on Mac, so they were showing their actual size, I resized them to 38x38 and now they look like what I was looking for.
The iOS "Human Interface Guidelines" have suggested sizes for the custom icons in the Navigation Bar.
These sizes go from 24px to 28px for the #1x scale factor meaning that for the other scale factors we will have something like:
24px
48px#2x
72px#3x
28px
56px#2x
84px#3x
Of course, you are capable of adjusting these numbers to keep consistency across your application.
More information about this here
Hope this helps.-

How to properly resize app to visible bounds on UWP? (VisibleBoundsMode doesn't seem to work)

I have two UWP apps and after testing them out with Continuum I noticed the app bar of the OS (the bar with the Start button) at the bottom of the screen (it can be at each of the 4 edges of the screen, of course) was covering part of my app.
Now, I'm already using ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible) before calling Window.Current.Activate(), but that doesn't seem to solve the issue.
1) Why is it that setting the DesiredBoundsMode property doesn't seem to work here? Shouldn't that automatically resize the window
content to the visible bounds (ie. excluding system overlays like the
navigation bar or the app bar)?
The workaround I'm using for now on Windows 10 Mobile devices is to subscribe to the VisibleBoundsChanged event and then manually adjust the margins of my Window.Current.Content item to make sure it doesn't show anything behind covered areas of the screen.
Basically, I use the Window.Current.Bounds property and the ApplicationView.VisibleBounds property to calculate the occluded areas on the different edges of the app window, and increase the margins from there.
2) Is there a proper/better way to do this?
I mean, I'm quite sure there's another method that should be used to avoid this issue (considering there are tons of different situations like Continuum, navigation bar etc... that I don't think are supposed to be manually handled one by one).
Thank you for your help!
Use the subscription to the event VisibleBoundsChanged. This is the best solution that I found.
var curr = ApplicationView.GetForCurrentView();
if (curr.IsFullScreenMode == true)
{
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
curr.FullScreenSystemOverlayMode = FullScreenSystemOverlayMode.Minimal;
}
else
{
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
curr.FullScreenSystemOverlayMode = FullScreenSystemOverlayMode.Standard;
}

Changing cursor on mouse-over not working on Windows App

I am working on a Windows Store App using C#.
I am trying to change the cursor when the user hover over a rectangle but it is causing me problems.
Here is my code:
Rectangle item = sender as Rectangle;
item.Cursor = Cursors.AppStarting;
mouseVerticalPosition = e.GetCurrentPoint(null).Position.Y;
mouseHorizontalPosition = e.GetCurrentPoint(null).Position.X;
isMouseCaptured = true;
item.CapturePointer(e.Pointer);
It says 'Windows.UI.Xaml.Shapes.Rectangle' does not contain a definition for 'Cursor'.
You're confusing WPF with WinRT/XAML. These are both XAML-based UI technologies, but although superficially similar when looking at some basic controls and properties - these are completely separate implementations that have many differences once you start looking at the details. One of these is the Cursor property missing in the Windows Runtime.
You can use Window.Current.CoreWindow.PointerCursor property to get or set the cursor on the current window.
You can also use some attached behaviors I wrote in WinRT XAML Toolkit here to get an API similar to the WPF one where you set a cursor per element. There's a sample you can check here that shows how you can set a cursor on an element like this:
Extensions:FrameworkElementExtensions.SystemCursor="Arrow"

How can I use my own application bar with tilt effec?

For my Windows Phone 8 application, I'm implementing my own application bar (I can't use the application bar provided by the system). Everything is working fine, but I have one big problem: the tilt effect for menu items!
I've tried to used the tilt effect provided by the WP toolkit, but it doesn't look like the original one. So how can I use the exact tilt effect by the system application bar in my own application bar ?
Thanks.
because your own app bar is not Tiltable Item.
you can get the TiltEffect.cs file from this link:
http://code.msdn.microsoft.com/wpapps/Tilt-Effect-Sample-fab3b035
and then you should add your own app bar to the TiltableItems in TiltEffect's Constructor, some like this:
static TiltEffect()
{
// The tiltable items list.
TiltableItems = new List<Type>() { typeof(ButtonBase), typeof(ListBoxItem), };
TiltableItems.Add(typeof(Border));
TiltableItems.Add(typeof(TiltEffectAbleControl));
UseLogarithmicEase = false;
}

Scrolling marquee control fails to scroll with MediaClock set on another control

I am creating an application which shows full screen videos with a scrolling text ticker at the bottom.
I'm using the MediaElement control to display the videos and playlisting several together, setting a play duration.
I'm setting each media duration as follows:
var timeline = new MediaTimeline(_playlist.PlaylistItems[_playlistPlayPosition].LocalMediaFile);
timeline.Duration = _playlist.PlaylistItems[_playlistPlayPosition].Duration;
MediaViewPort.Clock = timeline.CreateClock(false) as MediaClock; //THIS CAUSES AN ISSUE!
if (MediaViewPort.Clock != null)
{
MediaViewPort.Clock.Completed += Clock_Completed;
MediaViewPort.Clock.CurrentTimeInvalidated += Clock_CurrentTimeInvalidated;
}
This all works perfectly fine.
I found an excellent scrolling marquee control (http://koderhack.blogspot.co.uk/2011/05/content-ticker-control-in-wpf.html) which I dropped in as is. The control does not scroll.
I commented out the line
MediaViewPort.Clock = timeline.CreateClock(false) as MediaClock;
and the control started to scroll, however now my media doesn't have a duration set any more.
The control code itself is too big to post on here, I anyone would like to help it is on the URL above.
I fail to see what the Clock on my MediaElement control would have this effect on a separate control. Can anyone advise? I would prefer not to start setting timers to monitor media duration...
got around the issue by launching the control in a separate chromeless window on a new thread.

Categories