I am using the Hubtile Control provided in the Silverlight toolkit ( August) and I haven't been able to figure out how to pin the tiles to the homepage. Totally clueless and I have thoroughly searched everywhere with no luck. Help appreciated!
You use the ShellTile API as described on MSDN to add a secondary tile to the Start screen.
If you're using HubTile controls within your application, then you'll need to handle a touch gesture (e.g. Tap event) to determine which tile to pin, but it all depends on your app.
Here's the article that gives you answer in more details, including the code:
http://igrali.wordpress.com/2011/09/27/how-to-pin-a-hubtile-to-start-screen/
Basically, you create a new StandardTileData and then call ShellTile.Create. The information for the StandardTileData object should be passed from the HubTile object:
private void CreateLiveTile(HubTile hubtile)
{
StandardTileData LiveTile = new StandardTileData
{
BackgroundImage = ((System.Windows.Media.Imaging.BitmapImage)
hubtile.Source).UriSource,
Title = hubtile.Title,
BackTitle = hubtile.Title,
BackContent = hubtile.Message
};
Find more details in the article!
Regards
Related
I am working on a Xamarin project that includes a build for GTK. I am attempting to create a custom renderer for many of the Controls, but am having trouble finding, accessing and changing the properties for the control. For example, I would like to replace the "magnifying glass" icon for the SearchBar control with something more similar to the default icon on the Android platform.
I've created the custom renderer:
namespace MyProject.GTK.CustomRenderers
{
public class CustomSearchBarRenderer : Xamarin.Forms.Platform.GTK.Renderers.SearchBarRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
{
base.OnElementChanged(e);
var searchBar = Control;
// How do I replace the image?
}
}
}
but from there I am at a loss as there are practically no resources on custom renderers for GTK. I've tried looking at the GTK.Renderers.SearchBarRenderer to see if the class its derived from contains any useful properties or methods, as well as trying to find something meaningful in the GTK documentation and the repository for the Xamarin.Forms.GTK package, to no avail. I'm just not really sure how to understand the inner workings of the controls in this build so I can't figure out what I should even be looking for. Any pointers or resources for this or any GTK specific custom renderer work would be much appreciated.
You can check Xamarin Forms GTK
SearchBar is implmented by the use of element called SearchEntry which uses ImageButton and the icon is set by below code
_searchButton.ImageWidget.Pixbuf = RenderIcon("gtk-find", IconSize.SmallToolbar, null); // Search icon
Refer
SearchEntry.GTK
SearchBar.GTK
This should help you begin modifying, if you can get access to SearchEntry in your custom renderer you can change icon, otherwise you will have to create your own search bar, which takes lot of effort.
Using xamarin forms (PCL),
I searched a lot but Can not find the exact solution,
Can i change the back button in toolbar or at least should i be able to change its color and the title color as well?
I am not sure for changing back button, but I was changing back button and title color.
An example, in App.cs file OnStart method I set that LoginPage is first page with black title, on this way
MainPage = new NavigationPage(new LoginPage()) { BarTextColor = Color.Black };
Please try something like this, I have some other examples if this one doesn't work.
My application is developed using Xamarin.iOS and I need to make it accessible. We couldn't find any help to achieve large text accessibility in xamarin.iOS. I found this link which explains how to achieve it in Xamarin.Forms and this about MonoTouch. Could someone help me how to achieve Large text accessibility on Xamarin.iOS.
Assign one of the UIFontTextStyles to your UI elements and when the app starts the element's text size will be set based upon the UIFontTextStyle and the user's current Accessibility Larger Text setting:
var uiLabel = new UILabel(new CGRect(40, 40, 200, 40));
uiLabel.Text = "StackOverflow";
uiLabel.Font = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Body);
View.AddSubview(uiLabel);
If you want to dynamically response to the Accessibility Larger Text changes so the user does not have to restart your app, subscribe to UIContentSizeCategoryDidChangeNotification and update your views:
NSNotificationCenter.DefaultCenter.AddObserver(
new NSString("UIContentSizeCategoryDidChangeNotification"),
(NSNotification obj) =>
{
Console.WriteLine("Update layouts/subviews/layers/etc...");
View.SetNeedsLayout();
},
null
);
MonoTouch and Xamarin.iOS are the same thing, just a different name.
It is achieved in the exact same way, where you set the Font property of your UILabel or UITextField to one of the available fonts in the UIFont static class like so:
var label = new UILabel
{
Font = UIFont.PreferredBody
};
This should automatically scale the fonts according to your Accessibility settings on iOS.
how can I change the flow direction of a Xamarin Forms Content Page from Left to Right to Right to Left? something like Windows Phone Flow Direction property?
#Hodor thanks, there is no support for such a thing (at least at this time). a workaround for this when using list views is to create multiple list item templates with LTR/RTL directions and use them accordin g to the current UI culture.
Another workaround for other controls is to implement a renderer for each control type and change its HorizontalOptions or XAlignment according to the UI culture.
it's 2017 and Xamarin forms does not support RTL yet..
It might be worth mentioning that the Grial UI Kit product has just added RTL support.
More details here
Try latest In latest Xamarin forms 3.0.0
If you’re making apps that support right-to-left languages, we have great news for you: Xamarin.Forms 3.0 makes it easier than ever to flip layouts to match language direction!
When supporting languages such as Arabic and Hebrew that flow right-to-left, you may now tap into the very easy to use FlowDirection property on any VisualElement instead of using platform-specifics or effects as you may have used previously. Because you already know the direction the device prefers by accessing Device.FlowDirection, updating your UI could be as easy as adding this to the head of your page in XAML:
FlowDirection="{x:Static Device.FlowDirection}"
For more information about updating your applications to support right-to-left layouts:
Right-To-Left Localization in Xamarin.Forms Blog
You mean the navigation flow?
Usually left => right means adding a page on the navigation stack and right => left means removing it.
You can extend a navigation controller on the "native" C# code and make custom animations. There are many ways to do that. Here's an example in MonoTouch
public partial class ScreenController : UINavigationController
{
private Page currentPage = null;
private void setCurrentPage(Page p)
{
currentPage = p;
//Using present View Controller: will set the current page to root.
PresentViewController(new UINavigationController(currentPage.CreateViewController())
{
ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal,
}, true, null);
//Using custom animation
PushControllerWithTransition(this, currentPage.CreateViewController(), UIViewAnimationOptions.TransitionFlipFromLeft);
}
public static void PushControllerWithTransition(this UINavigationController target, UIViewController controllerToPush,
UIViewAnimationOptions transition)
{
UIView.Transition(target.View, 0.75d, transition, delegate()
{
target.PushViewController(controllerToPush, false);
}, null);
}
}
I'am doing localized application in WP7 so I make my app bar in code. The problem appears when I have some form (registration, login etc.). In Blend everything looks all right, but when I emulate it on device my gird with textboxes, textblocks is totally different (sometimes they are on each other)
My solution is to build empty app bar in Blend (PhoneApplicationPage -> New (Common Properties)) and then make new one in code like that:
private void BuildApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton OkAppBarButton = new ApplicationBarIconButton(new Uri("icons/ok.png", UriKind.Relative));
OkAppBarButton.Text = AppResource.OkAppBarButton;
ApplicationBar.Buttons.Add(OkAppBarButton);
OkAppBarButton.Click += new EventHandler(OkAppBarButton_Click);
ApplicationBarIconButton CancelAppBarButton = new ApplicationBarIconButton(new Uri("icons/cancel.png", UriKind.Relative));
CancelAppBarButton.Text = AppResource.CancelAppBarButton;
ApplicationBar.Buttons.Add(CancelAppBarButton);
CancelAppBarButton.Click += new EventHandler(CancelAppBarButton_Click);
}
Works good, but I wanted just to be sure is that the proper way to handle with that?
#dargod. There are a number of frameworks around to help build and bind the appbar. The key problem with the app bar that many people have complained about is that fact that the bar does not support commanding out of the box, so does not lend itself to MVVM.
Here are some links that may help
AppBarUtils
Bindable App bar