本文整理汇总了C#中Xamarin.Forms.View类的典型用法代码示例。如果您正苦于以下问题:C# View类的具体用法?C# View怎么用?C# View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
View类属于Xamarin.Forms命名空间,在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuestionInputViewContainer
public QuestionInputViewContainer(IQuestion question, View view, SurveyPageAppearance appearance)
{
view.HorizontalOptions = LayoutOptions.FillAndExpand;
var errorLabel = new Label {
Style = appearance.QuestionErrorLabelStyle,
Text = String.Empty,
IsVisible = false,
HorizontalOptions = LayoutOptions.FillAndExpand
};
question.PropertyChanged += (sender, e) => {
if (e.PropertyName == "HasError") {
if (question.HasError) {
errorLabel.Text = question.ErrorMessage;
errorLabel.IsVisible = true;
} else {
errorLabel.IsVisible = false;
}
}
};
Content = new StackLayout {
Orientation = StackOrientation.Vertical,
Style = appearance.QuestionInputViewContainerLayoutStyle,
Children = {
view,
errorLabel
}
};
}
示例2: Disposing
public override void Disposing(View content, PopupPage page)
{
if (HasBackgroundAnimation && page.BackgroundImage == null)
{
page.BackgroundColor = _backgroundColor;
}
}
示例3: QuestionContainerView
public QuestionContainerView(ISurveyItem item, View questionView, SurveyPageAppearance appearance)
{
var headerView = new QuestionHeaderView (item, appearance) {
VerticalOptions = LayoutOptions.Start
};
var inputStackLayout = new StackLayout () {
Style = appearance.QuestionContainerLayoutStyle,
Children = {
StandardViews.CreateSeparator (appearance.ItemSeperatorStyle),
questionView,
StandardViews.CreateSeparator (appearance.ItemSeperatorStyle)
}
};
var stackLayout = new StackLayout {
HorizontalOptions = LayoutOptions.FillAndExpand,
Children = {
headerView,
inputStackLayout,
}
};
if (!String.IsNullOrWhiteSpace (item.Footnote)) {
var footerView = new QuestionFooterView (item, appearance);
stackLayout.Children.Add (footerView);
}
Content = stackLayout;
}
示例4: AnimationListAdd
public void AnimationListAdd(View view)
{
if (!isListShowed)
view.RotationX = 90;
animationList.Add(view);
}
示例5: AddToContext
public void AddToContext(View view, bool inputTransparent = true)
{
panelLayout.Children.RemoveAt(panelLayout.Children.Count - 1);
if (inputTransparent)
{
var viewGestures = new ViewGestures();
viewGestures.Content = view;
viewGestures.BackgroundColor = BackgroundColor;
viewGestures.Tap += (s, e) => { OnClick(); };
if (panelAlignEnum == PanelAlignEnum.paLeft)
viewGestures.SwipeLeft += (s, e) => { OnClick(); };
else if (panelAlignEnum == PanelAlignEnum.paRight)
viewGestures.SwipeRight += (s, e) => { OnClick(); };
AddView(viewGestures);
previousView = viewGestures;
}
else
{
AddView(view);
previousView = view;
}
CloseContext();
}
示例6: ShowPopup
/// <summary>
/// Shows the _popup centered to the parent view.
/// </summary>
/// <param name="popupView">The _popup view.</param>
public void ShowPopup(View popupView) {
ShowPopup(
popupView,
Constraint.RelativeToParent(p => (Width - _popup.WidthRequest) / 2),
Constraint.RelativeToParent(p => (Height -_popup.HeightRequest) / 2)
);
}
示例7: Appearing
public async override Task Appearing(View content, PopupPage page)
{
var taskList = new List<Task>();
taskList.Add(base.Appearing(content, page));
if (content != null)
{
var topOffset = GetTopOffset(content, page);
var leftOffset = GetLeftOffset(content, page);
if (PositionIn == MoveAnimationOptions.Top)
{
content.TranslationY = -topOffset;
}
else if (PositionIn == MoveAnimationOptions.Bottom)
{
content.TranslationY = topOffset;
}
else if (PositionIn == MoveAnimationOptions.Left)
{
content.TranslationX = -leftOffset;
}
else if (PositionIn == MoveAnimationOptions.Right)
{
content.TranslationX = leftOffset;
}
taskList.Add(content.TranslateTo(_defaultTranslationX, _defaultTranslationY, DurationIn, EasingIn));
}
page.IsVisible = true;
await Task.WhenAll(taskList);
}
示例8: Create
/// <summary>
/// Instantiate a new <see cref="PopupTappedEventArgs"/>
/// </summary>
/// <param name="popup">The popup that was tapped</param>
/// <param name="view">The view that was tapped</param>
/// <returns></returns>
public static PopupTappedEventArgs Create(Popup popup, View view)
{
PopupSectionType housingSectionType;
var parentView = view.FindParent(ve =>
{
var parentSectionType = ve.GetValue(Popup.SectionTypeProperty);
var currentSection = (PopupSectionType)parentSectionType;
return currentSection == PopupSectionType.Body
|| currentSection == PopupSectionType.Footer
|| currentSection == PopupSectionType.Header;
});
if (parentView == null)
{
housingSectionType = PopupSectionType.Backdrop;
}
else
{
housingSectionType = (PopupSectionType)parentView.GetValue(Popup.SectionTypeProperty);
}
var controlType = (PopupSectionType)view.GetValue(Popup.SectionTypeProperty);
var evt = new PopupTappedEventArgs
{
Popup = popup,
ControlTapped = view,
IsUserControl = controlType == PopupSectionType.NotSet,
Section = housingSectionType
};
return evt;
}
示例9: ContainsTransaction
public bool ContainsTransaction(View view)
{
if(view == null)
throw new ArgumentNullException("view");
return _transactions.ContainsKey(view);
}
示例10: OnClick
public void OnClick(View view)
{
var renderer = view.Tag as AppCompatButtonRenderer;
if (renderer != null)
renderer.Element.InvokeSendClicked();
}
示例11: ShadowBoxCell
public ShadowBoxCell(View content, double boxHeight, double boxWidth)
{
BoxWidth = boxWidth;
BoxHeight = boxHeight;
var frameImage = new Frame {
Padding = 5,
Content = content,
BackgroundColor = Color.White,
HasShadow = false,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
OutlineColor = Color.Black,
HeightRequest = BoxHeight,
WidthRequest = BoxWidth,
MinimumHeightRequest = BoxHeight,
MinimumWidthRequest = BoxWidth,
};
var frameBackground1 = new Frame {
Padding = 5,
BackgroundColor = Color.Gray,
HasShadow = false,
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
OutlineColor = Color.Black,
HeightRequest = BoxHeight,
WidthRequest = BoxWidth,
MinimumHeightRequest = BoxHeight,
MinimumWidthRequest = BoxWidth,
};
var grid = new Grid {
RowSpacing = 0,
Padding = new Thickness (0, 0, 0, 0),
};
grid.RowDefinitions.Add (new RowDefinition { Height = new GridLength (300) });
grid.ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (300) });
var relativeLayout = new RelativeLayout ();
relativeLayout.Children.Add (frameBackground1,
Constraint.Constant (2),
Constraint.Constant (2)
);
relativeLayout.Children.Add (frameImage,
Constraint.RelativeToView (frameBackground1, (parent, sibling) => {
return sibling.X - 1;
}),
Constraint.RelativeToView (frameBackground1, (parent, sibling) => {
return sibling.Y - 1;
}));
grid.Children.Add (relativeLayout, 0, 0);
Content = grid;
}
示例12: Preparing
public override void Preparing(View content, PopupPage page)
{
if (HasBackgroundAnimation && page.BackgroundImage == null)
{
_backgroundColor = page.BackgroundColor;
page.BackgroundColor = GetColor(0);
}
}
示例13: GetTransactionFor
public Transaction GetTransactionFor(View view)
{
var transaction = _transactions.First(x => x.Key == view);
var transactionValue = transaction.Value;
return transactionValue;
}
示例14: ShowPopup
/// <summary>
/// Shows the popup centered to the parent view.
/// </summary>
/// <param name="popupView">The popup view.</param>
public void ShowPopup(View popupView)
{
this.ShowPopup(
popupView,
Constraint.RelativeToParent(p => (this.Width - this.popup.WidthRequest) / 2),
Constraint.RelativeToParent(p => (this.Height- this.popup.HeightRequest) / 2)
);
}
示例15: ViewWithGridPosition
public ViewWithGridPosition(View view, int row, int column, int rowSpan = 1, int columnSpan = 1)
{
this.View = view;
this.Row = row;
this.RowSpan = rowSpan;
this.Column = column;
this.ColumnSpan = columnSpan;
}