本文整理汇总了C#中Xamarin.Forms.VisualElement类的典型用法代码示例。如果您正苦于以下问题:C# VisualElement类的具体用法?C# VisualElement怎么用?C# VisualElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisualElement类属于Xamarin.Forms命名空间,在下文中一共展示了VisualElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnModelChanged
protected override void OnModelChanged(VisualElement oldModel, VisualElement newModel)
{
base.OnModelChanged(oldModel, newModel);
// this is a ViewGroup - so should be able to load an AXML file and FindView<>
var activity = this.Context as Activity;
var auth = new OAuth2Authenticator(
clientId: "574134802616730", // your OAuth2 client id
scope: "email,user_about_me", // the scopes for the particular API you're accessing, delimited by "+" symbols
authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"), // the auth URL for the service
redirectUrl: new Uri("https://www.cautom.com/SocialAuth/FBLogin/")); // the redirect URL for the service
auth.Completed += (sender, eventArgs) =>
{
if (eventArgs.IsAuthenticated)
{
//App.SuccessfulLoginAction.Invoke();
// Use eventArgs.Account to do wonderful things
//App.SaveToken(eventArgs.Account.Properties["access_token"]);
string accessToken = eventArgs.Account.Properties["access_token"];
new FacebookLoginWebView().fetchUserInfoFromAccessToken(accessToken);
}
else
{
// The user cancelled
}
};
activity.StartActivity(auth.GetUI(activity));
}
示例2: OnElementChanged
protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
{
base.OnElementChanged(oldElement, newElement);
if (oldElement != null)
{
oldElement.PropertyChanged -= this.HandleMasterDetailPagePropertyChanged;
oldElement.PropertyChanging -= this.HandleMasterDetailPagePropertyChanging;
}
if (newElement != null)
{
newElement.PropertyChanged += this.HandleMasterDetailPagePropertyChanged;
newElement.PropertyChanging += this.HandleMasterDetailPagePropertyChanging;
}
if (oldElement == null && newElement != null)
{
this.SetFitsSystemWindows(true);
var activity = (Activity)this.Context;
this.actionBarDrawerToggle = new CustomActionBarDrawerToggle(this, activity, this) { DrawerIndicatorEnabled = true };
this.ActionBar.SetDisplayHomeAsUpEnabled(true);
this.ActionBar.SetHomeButtonEnabled(true);
this.actionBarDrawerToggle.SyncState();
this.BindNavigationEventHandlers();
}
}
示例3: OnModelChanged
protected override void OnModelChanged (VisualElement oldModel, VisualElement newModel)
{
base.OnModelChanged (oldModel, newModel);
// this is a ViewGroup - so should be able to load an AXML file and FindView<>
var activity = this.Context as Activity;
var auth = new OAuth2Authenticator (
clientId: App.Instance.OAuthSettings.ClientId, // your OAuth2 client id
scope: App.Instance.OAuthSettings.Scope, // The scopes for the particular API you're accessing. The format for this will vary by API.
authorizeUrl: new Uri (App.Instance.OAuthSettings.AuthorizeUrl), // the auth URL for the service
redirectUrl: new Uri (App.Instance.OAuthSettings.RedirectUrl)); // the redirect URL for the service
auth.Completed += (sender, eventArgs) => {
if (eventArgs.IsAuthenticated) {
App.Instance.SuccessfulLoginAction.Invoke();
// Use eventArgs.Account to do wonderful things
App.Instance.SaveToken(eventArgs.Account.Properties["access_token"]);
} else {
// The user cancelled
}
};
activity.StartActivity (auth.GetUI(activity));
}
示例4: SetElement
public void SetElement(VisualElement element)
{
var oldElement = this.Element;
if (oldElement != null)
oldElement.PropertyChanged -= HandlePropertyChanged;
this.Element = element;
if (this.Element != null)
{
this.Element.PropertyChanged += HandlePropertyChanged;
}
ViewGroup.RemoveAllViews();
Tracker = new VisualElementTracker(this);
Packager = new VisualElementPackager(this);
Packager.Load();
UseCompatPadding = true;
SetContentPadding((int)TheView.Padding.Left, (int)TheView.Padding.Top,
(int)TheView.Padding.Right, (int)TheView.Padding.Bottom);
Radius = TheView.CornerRadius;
SetCardBackgroundColor(TheView.BackgroundColor.ToAndroid());
if (ElementChanged != null)
ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
}
示例5: SetElement
/// <summary>
/// Setup our SwipeRefreshLayout and register for property changed notifications.
/// </summary>
/// <param name="element">Element.</param>
public void SetElement(VisualElement element)
{
var oldElement = Element;
//unregister old and re-register new
if (oldElement != null)
oldElement.PropertyChanged -= HandlePropertyChanged;
Element = element;
if (Element != null)
{
UpdateContent();
Element.PropertyChanged += HandlePropertyChanged;
}
if (!init)
{
init = true;
//sizes to match the forms view
//updates properties, handles visual element properties
Tracker = new VisualElementTracker(this);
SetOnRefreshListener(this);
}
UpdateColors();
UpdateIsRefreshing();
UpdateIsSwipeToRefreshEnabled();
if (ElementChanged != null)
ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
}
示例6: Invoke
async protected override void Invoke(VisualElement visual)
{
visual.AnchorX = Anchor.X;
visual.AnchorY = Anchor.Y;
await Task.Delay(Delay);
await visual.ScaleTo(Scale, (uint)Length, Easing);
}
示例7: SetElement
public void SetElement(VisualElement element)
{
var oldElement = this.Element;
if (oldElement != null)
{
oldElement.PropertyChanged -= this.HandlePropertyChanged;
}
this.Element = element;
if (this.Element != null)
{
this.Element.PropertyChanged += this.HandlePropertyChanged;
}
this.RemoveAllSubviews();
this.Tracker = new VisualElementTracker(this);
this.Packager = new VisualElementPackager(this);
this.Packager.Load();
this.SetContentPadding((int)TheView.Padding.Left, (int)TheView.Padding.Top, (int)TheView.Padding.Right, (int)TheView.Padding.Bottom);
this.SetCardBackgroundColor(this.TheView.BackgroundColor.ToUIColor());
if (ElementChanged != null)
{
this.ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
}
}
示例8: SetElement
public void SetElement(VisualElement element)
{
var oldElement = this.Element;
if (oldElement != null)
{
this.HookPropertyChanged(oldElement);
}
if (oldElement == null)
{
this.Element = element;
this.UnhookPropertyChanged(this.Element);
this.Tracker = new VisualElementTracker(this);
if (this.Control == null)
{
this.Control = this.CreateFloatingActionButton();
this.Control.Clickable = true;
this.Control.SetOnClickListener(new OnClickListener(x => this.FloatingButton.ExecuteCommand()));
this.UpdateColorState();
this.UpdateIcon();
}
this.AddView(this.Control);
}
this.OnElementChanged(new VisualElementChangedEventArgs(oldElement, this.Element));
}
示例9: SetElement
public void SetElement(VisualElement element)
{
var oldElement = this.Element;
if (oldElement != null)
oldElement.PropertyChanged -= HandlePropertyChanged;
this.Element = element;
if (this.Element != null) {
//UpdateContent ();
this.Element.PropertyChanged += HandlePropertyChanged;
}
this.ViewGroup.RemoveAllViews ();
//sizes to match the forms view
//updates properties, handles visual element properties
this.Tracker = new VisualElementTracker (this);
this.Packager = new VisualElementPackager (this);
this.Packager.Load ();
this.UseCompatPadding = true;
this.SetContentPadding ((int)TheView.Padding.Left, (int)TheView.Padding.Top, (int)TheView.Padding.Right, (int)TheView.Padding.Bottom);
this.Radius = TheView.CornderRadius;
this.SetCardBackgroundColor(TheView.BackgroundColor.ToAndroid ());
if (this.ElementChanged != null)
{
this.ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
}
}
示例10: LayoutOperation
/// <summary>
/// Constructor.
/// </summary>
/// <param name="element">The element that caused the layout operation.</param>
/// <param name="other">The list of other elements that were affected by the operation.</param>
/// <param name="direction">The direction that the layout should be performed in.</param>
/// <param name="value">The value that the elements will be affected by in the layout direction.</param>
internal LayoutOperation(VisualElement element, IEnumerable<VisualElement> other, LayoutDirection direction, double value)
{
RootElement = element;
Elements = new [] { element }.Union(other).ToList();
Direction = direction;
Value = value;
}
示例11: AdaptForBinding
public static void AdaptForBinding(VisualElement element, IMvxBindingContextOwner contextOwner)
{
var mvxPage = element as IMvxContentPage;
if (mvxPage != null) {
contextOwner.BindingContext = new MvxBindingContext();
contextOwner.BindingContext.DataContext = mvxPage.ViewModel;
}
}
示例12: OnElementChanged
protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement) {
base.OnElementChanged(oldElement, newElement);
var fld = typeof(MasterDetailPageRenderer).GetField("detailLayout", BindingFlags.NonPublic | BindingFlags.Instance);
var fldValue = fld.GetValue(this);
var p = fld.FieldType.GetProperty("TopPadding", BindingFlags.Public | BindingFlags.Instance);
p.SetValue(fldValue, 0);
}
示例13: OnModelChanged
protected override void OnModelChanged (VisualElement oldModel, VisualElement newModel)
{
base.OnModelChanged (oldModel, newModel);
var tableView = Control as global::Android.Widget.ListView;
tableView.DividerHeight = 0;
tableView.SetBackgroundColor (new global::Android.Graphics.Color(0x2C, 0x3E, 0x50));
}
示例14: FocusEventArgs
public FocusEventArgs(VisualElement visualElement, bool isFocused)
{
if (visualElement == null)
throw new ArgumentNullException("visualElement");
VisualElement = visualElement;
IsFocused = isFocused;
}
示例15: ColorAnimation
static Task<bool> ColorAnimation(VisualElement element, string name, Func<double, Color> transform, Action<Color> callback, uint length, Easing easing)
{
easing = easing ?? Easing.Linear;
var taskCompletionSource = new TaskCompletionSource<bool>();
element.Animate<Color>(name, transform, callback, 16, length, easing, (v, c) => taskCompletionSource.SetResult(c));
return taskCompletionSource.Task;
}