public VirtualizingStackLayout() { _visibleItems = new List <View>(); _locations = new Dictionary <View, Rectangle>(); CompressedLayout.SetIsHeadless(this, true); }
public static void CompressedLayoutHeadless(Layout layout, bool apply = true) { if (!apply) { return; } foreach (var child in layout.Children) { if (child is Layout currentLayout) { CompressedLayoutHeadless(currentLayout); } if (child is Layout currentLayoutHeadless) { CompressedLayout.SetIsHeadless(child, true); } } }
public static RelativeLayout IsHeadless(this RelativeLayout layout) { if (CoreSettings.OS == DeviceOS.ANDROID) { CompressedLayout.SetIsHeadless(layout, true); } return(layout); }
public PopupRootLayout() { _shadowBorder = CreateShadowBorder(); Children.Add(_shadowBorder); _border = CreateBorder(); Children.Add(_border); // Create container for content _contentContainer = new Container(); CompressedLayout.SetIsHeadless(_contentContainer, true); _border.Content = _contentContainer; }
public static void CompressAllLayouts(this Layout <View> layout) { var childLayouts = GetChildLayouts(layout); foreach (var childLayout in childLayouts) { CompressAllLayouts(childLayout); } if (layout.BackgroundColor == default && !layout.GestureRecognizers.Any()) { CompressedLayout.SetIsHeadless(layout, true); } }
public MechLab() { this.Title = "Main Menu"; var scroll = new ScrollView(); Content = scroll; StackLayout stackLayout = new StackLayout(); Button button = new Button(); button.Clicked += Button_Clicked; button.Text = "Read MTF"; stackLayout.Children.Add(button); CompressedLayout.SetIsHeadless(stackLayout, true); Content = new ScrollView { Content = stackLayout }; }
public MarketMainPage() { //#region NAVIGATION PAGE //NavigationPage.SetTitleView(this, new RoundedEntry //{ // FontSize = 13.5, // Placeholder = "Buscar en Chappsy Market", // HeightRequest = 30, // HorizontalOptions = LayoutOptions.FillAndExpand, //}); //#endregion #region CATEGORIES CAROUSEL Categories = new CollectionView { BackgroundColor = Color.White, SelectionMode = SelectionMode.Single, Margin = new Thickness(10, 0), HeightRequest = 53, ItemsLayout = ListItemsLayout.HorizontalList, ItemTemplate = new CategoryTemplateSelector(), ItemsSource = new List <CategoryModel> { new CategoryModel { Name = "cube 1", Icon = "cube.svg" }, new CategoryModel { Name = "cube 1", Icon = "cube.svg" } } }; #endregion #region PRODUCT TIMELINE Source = new ObservableCollection <ProductModel> { // Header new ProductModel { Index = -1 } }; List <ProductModel> list = new List <ProductModel>(); for (int i = 0; i < 25; i++) { list.Add(new ProductModel { Index = i, Description = "Lorem ipsum dolor sit amet consectetur adipiscing elit phasellus mollis hac, accumsan interdum conubia suscipit per sollicitudin odio tristique id.", Title = "Lorem ipsum.", Price = "$10", Pictures = new List <string> { "http://i.dailymail.co.uk/i/pix/2015/09/01/18/2BE1E88B00000578-3218613-image-m-5_1441127035222.jpg" } }); } PopulateProductsLists(list); var collection = new CustomObject.ReciclerView.RecyclerView(); collection.ScrollChange += Collection_ScrollChange; collection.ItemTapped += Collection_ItemTapped;; collection.ItemsSource = Source; #endregion //var ConectivityMessage = CreateConectivityMessage(); //ConectivityMessage.SetBinding(View.IsVisibleProperty, nameof(MarketMainPageViewModel.IsConectivityDisable)); var MainContainer = new Grid { Padding = new Thickness(5, 0), RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; MainContainer.Children.Add(collection, 0, 0); CompressedLayout.SetIsHeadless(MainContainer, true); #region MainContainer var Absolutelayout = new AbsoluteLayout(); AbsoluteLayout.SetLayoutBounds(Categories, new Rectangle(0, 0, 1, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags(Categories, AbsoluteLayoutFlags.WidthProportional); //AbsoluteLayout.SetLayoutBounds(ConectivityMessage, new Rectangle(.5, .6, 64 * 2, 64 * 2)); //AbsoluteLayout.SetLayoutFlags(ConectivityMessage, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(MainContainer, new Rectangle(0, 0, 1, 1)); AbsoluteLayout.SetLayoutFlags(MainContainer, AbsoluteLayoutFlags.SizeProportional); Absolutelayout.Children.Add(MainContainer); //Absolutelayout.Children.Add(ConectivityMessage); Absolutelayout.Children.Add(Categories); #endregion Content = Absolutelayout; }
public FramesPageCS() { Title = "Frames"; Icon = "csharp.png"; // SearchBar SearchBar searchBar = new SearchBar { Placeholder = "Enter your search here.", }; searchBar.TextChanged += (sender, e) => { return; }; searchBar.SearchButtonPressed += (sender, e) => { return; }; // Filter Toolbar Item ToolbarItem toolbarItem = new ToolbarItem { Text = "F", Command = ShowRoomsFilterPage, }; this.ToolbarItems.Add( toolbarItem ); this.SlideMenu = new RoomsFilterPage(); // Rooms DataTemplate var roomsDataTemplate = new DataTemplate(() => { var grid = new Grid(); CompressedLayout.SetIsHeadless(grid, true); grid.RowDefinitions.Add(new RowDefinition { Height = 20 }); //grid.RowDefinitions.Add(new RowDefinition { Height = 700 }); grid.RowSpacing = 0; grid.ColumnSpacing = 10; grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.5, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) }); var indexLabel = new Label { IsVisible = false }; var nameLabel = new Label { FontAttributes = FontAttributes.Bold }; indexLabel.SetBinding(Label.TextProperty, "Index"); nameLabel.SetBinding(Label.TextProperty, "Name"); grid.Children.Add(indexLabel, 0, 1, 0, 1); grid.Children.Add(nameLabel, 0, 1, 0, 1); var timeSlotsLayout = new TimeSlotsFrameLayout(); timeSlotsLayout.Padding = 20; timeSlotsLayout.WidthRequest = 300; timeSlotsLayout.HorizontalOptions = LayoutOptions.Start; timeSlotsLayout.SetBinding(TimeSlotsFrameLayout.TimeSlotsSourceProperty, "TimeSlots"); grid.Children.Add(timeSlotsLayout, 0, 3, 1, 2); return(new ViewCell { View = grid }); }); // Rooms ListView listView = new ListView() { ItemsSource = App.RoomsViewModel.Rooms, ItemTemplate = roomsDataTemplate, //RowHeight = 150, HasUnevenRows = true, SeparatorColor = Color.Transparent, }; listView.Margin = new Thickness(10); //listView.On<Platform::Android>().SetIsFastScrollEnabled(true); // Next Button Button nextButton = new Button { Text = "Next", BindingContext = App.RoomsViewModel, Command = GoToRoomDetailPage, WidthRequest = 60.0, HeightRequest = 40.0, BorderWidth = 1, BorderColor = Color.Green, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill, FontAttributes = FontAttributes.Bold, FontSize = 11.0, BackgroundColor = Color.Green, TextColor = Color.White, }; nextButton.SetBinding(Button.IsEnabledProperty, "EnableRoomDetailNextButton"); nextButton.Triggers.Add(new Trigger(typeof(Button)) { Property = Button.IsEnabledProperty, Value = true, Setters = { new Setter { Property = Button.BackgroundColorProperty, Value = "Green" } } }); nextButton.Triggers.Add(new Trigger(typeof(Button)) { Property = Button.IsEnabledProperty, Value = false, Setters = { new Setter { Property = Button.BackgroundColorProperty, Value = "LightGray" } } }); var testLabel = new Label { Text = "Yo, yo, Dude", TextColor = Color.Green, //BackgroundColor = Color.Transparent, FontSize = 14.0, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, }; var testFrame = new TimeSlotFrame { Content = testLabel, WidthRequest = 60.0, HeightRequest = 40.0, //FontSize = 11.0, //BorderWidth = 1, //BorderColor = Color.Green, OutlineColor = Color.Green, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill, //FontAttributes = FontAttributes.Bold, BackgroundColor = Color.White, //TextColor = Color.Green, }; Content = new StackLayout { Padding = new Thickness(0, 0, 0, 0), WidthRequest = 300, Children = { /* * new Label { * Text = "Buttons List", * FontAttributes = FontAttributes.Bold, * HorizontalOptions = LayoutOptions.Center * }, */ searchBar, listView, nextButton, } }; }
public MainPage() { _vm = new MainPageViewModel(); this.BindingContext = _vm; Button buttonStart = new Button { Text = "START SCANNING BEACONS" }; buttonStart.SetBinding(Button.CommandProperty, "StartRangingCommand"); buttonStart.SetBinding(Button.TextProperty, new Binding("IsStartedRanging", converter: new IsStartedRangingToTextConverter())); Label labelInfo = new Label() { HorizontalOptions = LayoutOptions.Center, Text = "Beacons oredered by RSSI" }; Button buttonTransmit = new Button { Text = "START BEACON" }; buttonTransmit.SetBinding(Button.CommandProperty, "StartTransmitting"); buttonTransmit.SetBinding(Button.TextProperty, new Binding("IsTransmitting", converter: new IsTransmittingToTextConverter())); StackLayout slHeader = new StackLayout() { Children = { buttonTransmit, buttonStart, labelInfo, } }; ListView lv = new ListView { HasUnevenRows = true, SeparatorColor = Color.Black, SeparatorVisibility = SeparatorVisibility.Default, Header = slHeader }; lv.SetBinding(ListView.ItemsSourceProperty, "ReceivedBeacons"); lv.SetBinding(ListView.ItemTemplateProperty, "ViewCellBeaconTemplate"); StackLayout sl = new StackLayout { Children = { lv } }; CompressedLayout.SetIsHeadless(sl, true); Content = sl; InvokeCommandAction icaOnAppearing = new InvokeCommandAction(); icaOnAppearing.SetBinding(InvokeCommandAction.CommandProperty, "OnAppearingCommand"); EventHandlerBehavior ehbOnAppearing = new EventHandlerBehavior() { EventName = "Appearing" }; ehbOnAppearing.Actions.Add(icaOnAppearing); InvokeCommandAction icaOnDisappearing = new InvokeCommandAction(); icaOnDisappearing.SetBinding(InvokeCommandAction.CommandProperty, "OnDisappearingCommand"); EventHandlerBehavior ehbOnDisappearing = new EventHandlerBehavior() { EventName = "Disappearing" }; ehbOnDisappearing.Actions.Add(icaOnDisappearing); this.Behaviors.Add(ehbOnAppearing); this.Behaviors.Add(ehbOnDisappearing); }
public CustomViewCellFavPage(Result result) { HeightRequest = 350; Direction = FlexDirection.Column; Margin = 16; AlignContent = FlexAlignContent.Center; Container = new Lazy<StackLayout>(() => new StackLayout() { Margin = 16, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.FillAndExpand }); SubContainer = new Lazy<StackLayout>(() => new StackLayout() { Margin = new Thickness(16, 0, 16, 0), HeightRequest = 280, BackgroundColor = Color.FromHex("#44312D2D"), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }); absoluteLayout = new Lazy<AbsoluteLayout>(() => new AbsoluteLayout() { VerticalOptions = LayoutOptions.FillAndExpand }); var BackdropPathSource = new UriImageSource() { CachingEnabled = true, CacheValidity = TimeSpan.MaxValue }; BackdropPathSource.SetBinding(UriImageSource.UriProperty, new Binding("BackdropPath", BindingMode.Default, new BackgroundImageUrlConverter())); //blurCachedImage = new Lazy<CachedImage>(() => new CachedImage() //{ // HeightRequest = 300, // WidthRequest = 300, // Opacity = 60, // Source = BackdropPathSource, // Transformations = Transformations, // HorizontalOptions = LayoutOptions.FillAndExpand, // Scale = 3, // VerticalOptions = LayoutOptions.FillAndExpand //}); blurCachedImage = new Lazy<Image>(() => new Image() { HeightRequest = 300, WidthRequest = 300, Opacity = 60, Source = BackdropPathSource, Scale = 3 }); var PosterPathSource = new UriImageSource() { CachingEnabled = true, CacheValidity = TimeSpan.MaxValue }; PosterPathSource.SetBinding(UriImageSource.UriProperty, new Binding("PosterPath", BindingMode.Default, new PosterImageUrlConverter())); cachedImage = new Lazy<Image>(() => new Image() { Aspect = Aspect.AspectFill, Source = PosterPathSource }); FrameCover = new Lazy<Frame>(() => new Frame() { IsClippedToBounds = true, Margin = new Thickness(0, 0, 0, 0), HasShadow = true, BorderColor = Color.FromHex("#00000000"), Padding = new Thickness(0, 0, 0, 0), BackgroundColor = Color.FromHex("#00000000"), CornerRadius = 15 }); panelContainer = new Lazy<StackLayout>(() => new StackLayout() { HeightRequest = 125, HorizontalOptions = LayoutOptions.Center, }); FrameUnderImages = new Lazy<Frame>(() => new Frame() { BackgroundColor = Color.FromHex("#44312D2D"), CornerRadius = 5, HasShadow = true, HorizontalOptions = LayoutOptions.Center }); ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star)}, new ColumnDefinition() { Width = GridLength.Star}, new ColumnDefinition() { Width = GridLength.Star} }; RowDefinitionCollection rowDefinitions = new RowDefinitionCollection() { new RowDefinition() { Height = GridLength.Star}, new RowDefinition() { Height = GridLength.Star} }; gridInsideFrame = new Lazy<Grid>(() => new Grid() { ColumnDefinitions = columnDefinitions, RowDefinitions = rowDefinitions }); title = new Lazy<Label>(() => new Label() { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextColor = Color.White, LineBreakMode = LineBreakMode.TailTruncation, Margin = new Thickness(16, 0, 0, 0), FontFamily = "Arial", FontAttributes = FontAttributes.Bold }); title.Value.SetBinding(Label.TextProperty, "Title"); releaseDate = new Lazy<Label>(() => new Label() { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), TextColor = Color.FromHex("#65FFFFFF"), LineBreakMode = LineBreakMode.NoWrap, Margin = new Thickness(16, 0, 0, 0), FontFamily = "Arial", FontAttributes = FontAttributes.Bold }); releaseDate.Value.SetBinding(Label.TextProperty, "ReleaseDate"); compat = new Lazy<StackLayout>(() => new StackLayout() { HeightRequest = 50 }); unPinFromFavList = new Lazy<Image>(() => new Image() { HeightRequest = 40, WidthRequest = 40 }); unPinFromFavList.Value.SetBinding(Image.SourceProperty, "FavoriteMovie"); FrameCover.Value.Content = cachedImage.Value; compat.Value.Children.Add(unPinFromFavList.Value); gridInsideFrame.Value.Children.Add(title.Value, 0, 0); Grid.SetColumnSpan(title.Value, 3); gridInsideFrame.Value.Children.Add(releaseDate.Value, 0, 1); gridInsideFrame.Value.Children.Add(compat.Value, 2, 1); AbsoluteLayout.SetLayoutBounds(blurCachedImage.Value, new Rectangle(.5, 0, 1, 1)); AbsoluteLayout.SetLayoutFlags(blurCachedImage.Value, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(FrameCover.Value, new Rectangle(.5, 0, 0.46, 1)); AbsoluteLayout.SetLayoutFlags(FrameCover.Value, AbsoluteLayoutFlags.All); FrameUnderImages.Value.Content = gridInsideFrame.Value; absoluteLayout.Value.Children.Add(blurCachedImage.Value); absoluteLayout.Value.Children.Add(FrameCover.Value); CompressedLayout.SetIsHeadless(absoluteLayout.Value, true); panelContainer.Value.Children.Add(FrameUnderImages.Value); SubContainer.Value.Children.Add(absoluteLayout.Value); CompressedLayout.SetIsHeadless(SubContainer.Value, true); Container.Value.Children.Add(SubContainer.Value); Container.Value.Children.Add(panelContainer.Value); Children.Add(Container.Value); tap = new TapGestureRecognizer(); tap.Tapped += QuitFromFavListTap; compat.Value.GestureRecognizers.Add(tap); Result = result; var OnTapNavigationGesture = new TapGestureRecognizer(); OnTapNavigationGesture.Tapped += OnTapNavigationGesture_Tapped; GestureRecognizers.Add(OnTapNavigationGesture); }
/// <summary> /// Initializes a new instance of the <see cref="T:AiForms.Effects.FloatingView"/> class. /// </summary> public FloatingView() { CompressedLayout.SetIsHeadless(this, true); }
public CustomViewCell(Result result) { try { Result = result; CompressedLayout.SetIsHeadless(this, true); HeightRequest = 350; Direction = FlexDirection.Column; Margin = 16; AlignContent = FlexAlignContent.Center; Container = new Lazy <StackLayout>(() => new StackLayout() { Margin = 8 }); CompressedLayout.SetIsHeadless(Container.Value, true); SubContainer = new Lazy <StackLayout>(() => new StackLayout() { Margin = new Thickness(0, 0, 0, 0), BackgroundColor = Color.Black }); absoluteLayout = new Lazy <AbsoluteLayout>(() => new AbsoluteLayout() { }); CompressedLayout.SetIsHeadless(absoluteLayout.Value, true); var uriToImgSource = new UriImageSource { CacheValidity = TimeSpan.FromDays(15), CachingEnabled = true }; cachedImage = new Lazy <CachedImage>(() => new CachedImage() { Aspect = Aspect.Fill, CacheDuration = TimeSpan.MaxValue, LoadingPriority = FFImageLoading.Work.LoadingPriority.Highest, LoadingPlaceholder = "Loading.png", RetryCount = 2, RetryDelay = 15, DownsampleToViewSize = true, Source = new UriImageSource { CacheValidity = TimeSpan.MaxValue, CachingEnabled = true, Uri = new Uri(string.Concat("https://image.tmdb.org/t/p/w370_and_h556_bestv2", Result.PosterPath)) } }); FrameCover = new Lazy <Frame>(() => new Frame() { IsClippedToBounds = true, Margin = new Thickness(0, 0, 0, 0), HeightRequest = 556, WidthRequest = 370, HasShadow = true, BorderColor = Color.FromHex("#00000000"), Padding = new Thickness(0, 0, 0, 0), BackgroundColor = Color.FromHex("#00000000"), CornerRadius = 15 }); panelContainer = new Lazy <StackLayout>(() => new StackLayout() { }); CompressedLayout.SetIsHeadless(panelContainer.Value, true); FrameUnderImages = new Lazy <Frame>(() => new Frame() { IsClippedToBounds = true, HeightRequest = 120, BackgroundColor = Color.Black, CornerRadius = 5, HasShadow = true }); ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition() { Width = GridLength.Star }, new ColumnDefinition() { Width = GridLength.Star } }; RowDefinitionCollection rowDefinitions = new RowDefinitionCollection() { new RowDefinition() { Height = GridLength.Star }, new RowDefinition() { Height = GridLength.Star } }; gridInsideFrame = new Lazy <Grid>(() => new Grid() { ColumnDefinitions = columnDefinitions, RowDefinitions = rowDefinitions }); title = new Lazy <Label>(() => new Label() { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextColor = Color.White, LineBreakMode = LineBreakMode.NoWrap, Margin = new Thickness(5, 0, 0, 0), FontFamily = "Arial", FontAttributes = FontAttributes.Bold, Text = Result.Title }); releaseDate = new Lazy <Label>(() => new Label() { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), TextColor = Color.FromHex("#65FFFFFF"), LineBreakMode = LineBreakMode.NoWrap, Margin = new Thickness(5, 0, 0, 0), FontFamily = "Arial", FontAttributes = FontAttributes.Bold, Text = Result.ReleaseDate }); pin2FavList = new Lazy <Image>(() => new Image() { HeightRequest = 40, WidthRequest = 40 }); pin2FavList.Value.SetBinding(Image.SourceProperty, "FavoriteMovie"); FrameCover.Value.Content = cachedImage.Value; gridInsideFrame.Value.Children.Add(title.Value, 0, 0); Grid.SetColumnSpan(title.Value, 3); gridInsideFrame.Value.Children.Add(releaseDate.Value, 0, 1); gridInsideFrame.Value.Children.Add(pin2FavList.Value, 2, 1); AbsoluteLayout.SetLayoutBounds(FrameCover.Value, new Rectangle(.5, 1, 1, 1)); AbsoluteLayout.SetLayoutFlags(FrameCover.Value, AbsoluteLayoutFlags.All); FrameUnderImages.Value.Content = gridInsideFrame.Value; absoluteLayout.Value.Children.Add(FrameCover.Value); panelContainer.Value.Children.Add(FrameUnderImages.Value); SubContainer.Value.Children.Add(absoluteLayout.Value); CompressedLayout.SetIsHeadless(SubContainer.Value, true); Container.Value.Children.Add(SubContainer.Value); Container.Value.Children.Add(panelContainer.Value); Children.Add(Container.Value); var VmInstance = Locator.Current.GetService <AllMoviesPageViewModel>(); pin2FavList.Value.TapGesture(t => { t.Command = VmInstance.AddToFavListCommand; t.CommandParameter = Result; }).TapGesture(r => { r.Command = new AsyncCommand(async() => { await pin2FavList.Value.ScaleTo(1.50, 500, Easing.BounceOut); await pin2FavList.Value.ScaleTo(1, 500, Easing.BounceIn); }); }); this.TapGesture(t => { t.Command = VmInstance.NavToDetailsPage; t.CommandParameter = Result; }); } catch (Exception ex) { Debug.WriteLine("Error: " + ex.InnerException); } }
public HomePage() { this.Title = "Main Menu"; var scroll = new ScrollView(); Content = scroll; StackLayout stackLayout = new StackLayout(); Image img = new Image(); img.Source = "Company.jpg"; img.HeightRequest = 120; img.WidthRequest = 600; stackLayout.Children.Add(img); Label lbl = new Label(); lbl.Text = "Companies"; lbl.FontSize = 40; lbl.HorizontalTextAlignment = TextAlignment.Center; lbl.TextColor = Color.White; stackLayout.Children.Add(lbl); Button button = new Button(); button.Text = "Add Company"; button.Clicked += Button_Clicked; stackLayout.Children.Add(button); button = new Button(); button.Text = "Manage Companies"; button.Clicked += btn_Edit_Companies_Clicked; stackLayout.Children.Add(button); stackLayout.BackgroundColor = Color.Gray; /* * BoxView box = new BoxView(); * box.Color = Color.Black; * box.WidthRequest = 100; * box.HeightRequest = 2; * stackLayout.Children.Add(box); * * img = new Image(); * img.Source = "Lance.jpg"; * img.HeightRequest = 120; * img.WidthRequest = 600; * stackLayout.Children.Add(img); * * lbl = new Label(); * lbl.Text = "Lances"; * lbl.FontSize = 40; * lbl.HorizontalTextAlignment = TextAlignment.Center; * lbl.TextColor = Color.White; * stackLayout.Children.Add(lbl); * * button = new Button(); * button.Text = "Add Lance"; * button.Clicked += btn_Add_Lance_Clicked; * stackLayout.Children.Add(button); * stackLayout.BackgroundColor = Color.Gray; * * button = new Button(); * button.Text = "Manage Lances"; * button.Clicked += btn_Edit_Lance_Clicked; * stackLayout.Children.Add(button); * stackLayout.BackgroundColor = Color.Gray; * * box = new BoxView(); * box.Color = Color.Black; * box.WidthRequest = 100; * box.HeightRequest = 2; * stackLayout.Children.Add(box); * * img = new Image(); * img.Source = "Pilots.jpg"; * img.HeightRequest = 120; * img.WidthRequest = 600; * stackLayout.Children.Add(img); * * lbl = new Label(); * lbl.Text = "Pilots"; * lbl.FontSize = 40; * lbl.HorizontalTextAlignment = TextAlignment.Center; * lbl.TextColor = Color.White; * stackLayout.Children.Add(lbl); * * button = new Button(); * button.Text = "Add Pilot"; * button.Clicked += btn_Add_Pilot_Clicked; * stackLayout.Children.Add(button); * stackLayout.BackgroundColor = Color.Gray; * * button = new Button(); * button.Text = "Manage Pilots"; * button.Clicked += btn_Edit_Pilot_Clicked; * stackLayout.Children.Add(button); * stackLayout.BackgroundColor = Color.Gray; */ BoxView box = new BoxView(); box.Color = Color.Black; box.WidthRequest = 100; box.HeightRequest = 2; stackLayout.Children.Add(box); img = new Image(); img.Source = "Dragon.png"; img.HeightRequest = 120; img.WidthRequest = 600; stackLayout.Children.Add(img); lbl = new Label(); lbl.Text = "Mech Lab"; lbl.FontSize = 40; lbl.HorizontalTextAlignment = TextAlignment.Center; lbl.TextColor = Color.White; stackLayout.Children.Add(lbl); button = new Button(); button.Text = "Edit Mechs"; button.Clicked += btn_ML_Clicked; stackLayout.Children.Add(button); stackLayout.BackgroundColor = Color.Gray; box = new BoxView(); box.Color = Color.Black; box.WidthRequest = 100; box.HeightRequest = 2; stackLayout.Children.Add(box); img = new Image(); img.Source = "BlankArmor.png"; img.HeightRequest = 120; img.WidthRequest = 600; stackLayout.Children.Add(img); lbl = new Label(); lbl.Text = "Record Sheets"; lbl.FontSize = 40; lbl.HorizontalTextAlignment = TextAlignment.Center; lbl.TextColor = Color.White; stackLayout.Children.Add(lbl); button = new Button(); button.Text = "Record Sheet"; button.Clicked += btn_RS_Clicked; stackLayout.Children.Add(button); stackLayout.BackgroundColor = Color.Gray; CompressedLayout.SetIsHeadless(stackLayout, true); Content = new ScrollView { Content = stackLayout }; }
public FramesPageCS() { Title = "Frames"; Icon = "csharp.png"; // Rooms DataTemplate var roomsDataTemplate = new DataTemplate(() => { var grid = new Grid(); CompressedLayout.SetIsHeadless(grid, true); grid.RowDefinitions.Add(new RowDefinition { Height = 20 }); grid.RowSpacing = 0; grid.ColumnSpacing = 10; grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.5, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) }); var indexLabel = new Label { IsVisible = false }; var nameLabel = new Label { FontAttributes = FontAttributes.Bold }; indexLabel.SetBinding(Label.TextProperty, "Index"); nameLabel.SetBinding(Label.TextProperty, "Name"); grid.Children.Add(indexLabel, 0, 1, 0, 1); grid.Children.Add(nameLabel, 0, 1, 0, 1); var timeSlotsLayout = new TimeSlotsWrapLayout(); timeSlotsLayout.Padding = 20; timeSlotsLayout.WidthRequest = 300; timeSlotsLayout.HorizontalOptions = LayoutOptions.Start; timeSlotsLayout.SetBinding(TimeSlotsWrapLayout.TimeSlotsSourceProperty, "TimeSlots"); grid.Children.Add(timeSlotsLayout, 0, 3, 1, 2); return(new ViewCell { View = grid }); }); // Rooms ListView listView = new ListView() { ItemTemplate = roomsDataTemplate, HasUnevenRows = true, SeparatorColor = Color.Transparent, }; listView.Margin = new Thickness(10); listView.SetBinding(ListView.ItemsSourceProperty, "Rooms", BindingMode.Default); // Add Button Button addButton = new Button { Text = "Add TimeSlot", BindingContext = App.RoomsViewModel, Command = AddTimeSlot, WidthRequest = 60.0, HeightRequest = 40.0, BorderWidth = 1, BorderColor = Color.Green, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill, FontAttributes = FontAttributes.Bold, FontSize = 20.0, BackgroundColor = Color.Green, TextColor = Color.White, }; Content = new StackLayout { Padding = new Thickness(0, 0, 0, 0), WidthRequest = 300, Children = { listView, addButton, } }; BindingContext = App.RoomsViewModel; }
public RepeaterView() { CompressedLayout.SetIsHeadless(this, true); Spacing = 0; }
public RecordSheetGeneral() { var db = new SQLiteConnection(_dbPath); AbsoluteLayout Layer1 = new AbsoluteLayout(); Layer1.BackgroundColor = Color.Gray; _mechModel = new Label(); _mechModel.Text = "CMD-1B Commando"; _mechModel.FontSize = 26; _mechModel.FontAttributes = FontAttributes.Bold; _mechModel.TextColor = Color.DarkGray; _mechModel.HorizontalTextAlignment = TextAlignment.Center; AbsoluteLayout.SetLayoutBounds(_mechModel, new Rectangle(0.5, 140, 1, 40)); AbsoluteLayout.SetLayoutFlags(_mechModel, AbsoluteLayoutFlags.XProportional); AbsoluteLayout.SetLayoutFlags(_mechModel, AbsoluteLayoutFlags.WidthProportional); Layer1.Children.Add(_mechModel); _mechName = new Entry(); _mechName.TextChanged += Txt_TextChanged; _mechName.Text = "Commando"; _mechName.TextColor = Color.White; _mechName.BackgroundColor = Color.Gray; AbsoluteLayout.SetLayoutBounds(_mechName, new Rectangle(0.5, 180, 1, 50)); AbsoluteLayout.SetLayoutFlags(_mechName, AbsoluteLayoutFlags.XProportional); AbsoluteLayout.SetLayoutFlags(_mechName, AbsoluteLayoutFlags.WidthProportional); Layer1.Children.Add(_mechName); _mechImage = new Image(); AbsoluteLayout.SetLayoutBounds(_mechImage, new Rectangle(0.5, 0, 120, 120)); AbsoluteLayout.SetLayoutFlags(_mechImage, AbsoluteLayoutFlags.PositionProportional); Layer1.Children.Add(_mechImage); AbsoluteLayout Layer2 = new AbsoluteLayout(); Layer2.BackgroundColor = Color.DarkGray; AbsoluteLayout.SetLayoutBounds(Layer2, new Rectangle(0, 220, 1, 50)); AbsoluteLayout.SetLayoutFlags(Layer2, AbsoluteLayoutFlags.WidthProportional); AbsoluteLayout Layer31 = new AbsoluteLayout(); Layer31.BackgroundColor = Color.White; AbsoluteLayout.SetLayoutBounds(Layer31, new Rectangle(0.5, 0, 130, 50)); AbsoluteLayout.SetLayoutFlags(Layer31, AbsoluteLayoutFlags.XProportional); AbsoluteLayout.SetLayoutFlags(Layer31, AbsoluteLayoutFlags.YProportional); _walkButton = new Button(); _walkButton.BackgroundColor = Color.Green; _walkButton.Pressed += Btn_Walk_Pressed; _walkButton.CornerRadius = 20; AbsoluteLayout.SetLayoutBounds(_walkButton, new Rectangle(5, 0.5, 40, 40)); AbsoluteLayout.SetLayoutFlags(_walkButton, AbsoluteLayoutFlags.YProportional); Layer31.Children.Add(_walkButton); _walkLabel = new Label(); _walkLabel.Text = "Walk 8"; _walkLabel.FontSize = 26; _walkLabel.FontAttributes = FontAttributes.Bold; _walkLabel.TextColor = Color.Black; AbsoluteLayout.SetLayoutBounds(_walkLabel, new Rectangle(50, 1, 1, 50)); AbsoluteLayout.SetLayoutFlags(_walkLabel, AbsoluteLayoutFlags.YProportional); AbsoluteLayout.SetLayoutFlags(_walkLabel, AbsoluteLayoutFlags.WidthProportional); Layer31.Children.Add(_walkLabel); Layer2.Children.Add(Layer31); AbsoluteLayout Layer32 = new AbsoluteLayout(); Layer32.BackgroundColor = Color.White; AbsoluteLayout.SetLayoutBounds(Layer32, new Rectangle(0.5, 0, 130, 50)); AbsoluteLayout.SetLayoutFlags(Layer32, AbsoluteLayoutFlags.PositionProportional); //AbsoluteLayout.SetLayoutFlags(Layer32, AbsoluteLayoutFlags.YProportional); _runButton = new Button(); _runButton.BackgroundColor = Color.Red; _runButton.Pressed += Btn_Run_Pressed; _runButton.CornerRadius = 20; AbsoluteLayout.SetLayoutBounds(_runButton, new Rectangle(5, 0.5, 40, 40)); AbsoluteLayout.SetLayoutFlags(_runButton, AbsoluteLayoutFlags.YProportional); Layer32.Children.Add(_runButton); _runLabel = new Label(); _runLabel.Text = "Run 12"; _runLabel.FontSize = 26; _runLabel.FontAttributes = FontAttributes.Bold; _runLabel.TextColor = Color.Black; AbsoluteLayout.SetLayoutBounds(_runLabel, new Rectangle(50, 1, 1, 50)); AbsoluteLayout.SetLayoutFlags(_runLabel, AbsoluteLayoutFlags.YProportional); AbsoluteLayout.SetLayoutFlags(_runLabel, AbsoluteLayoutFlags.WidthProportional); Layer32.Children.Add(_runLabel); Layer2.Children.Add(Layer32); AbsoluteLayout Layer33 = new AbsoluteLayout(); Layer33.BackgroundColor = Color.White; AbsoluteLayout.SetLayoutBounds(Layer33, new Rectangle(1, 0, 130, 50)); AbsoluteLayout.SetLayoutFlags(Layer33, AbsoluteLayoutFlags.PositionProportional); //AbsoluteLayout.SetLayoutFlags(Layer33, AbsoluteLayoutFlags.YProportional); _jumpButton = new Button(); _jumpButton.BackgroundColor = Color.LightBlue; _jumpButton.Pressed += Btn_Jump_Pressed; _jumpButton.CornerRadius = 20; AbsoluteLayout.SetLayoutBounds(_jumpButton, new Rectangle(5, 0.5, 40, 40)); AbsoluteLayout.SetLayoutFlags(_jumpButton, AbsoluteLayoutFlags.YProportional); Layer33.Children.Add(_jumpButton); _jumpLabel = new Label(); _jumpLabel.Text = "Jump 8"; _jumpLabel.FontSize = 26; _jumpLabel.FontAttributes = FontAttributes.Bold; _jumpLabel.TextColor = Color.Black; AbsoluteLayout.SetLayoutBounds(_jumpLabel, new Rectangle(50, 1, 1, 50)); AbsoluteLayout.SetLayoutFlags(_jumpLabel, AbsoluteLayoutFlags.YProportional); AbsoluteLayout.SetLayoutFlags(_jumpLabel, AbsoluteLayoutFlags.WidthProportional); Layer33.Children.Add(_jumpLabel); Layer2.Children.Add(Layer33); Layer1.Children.Add(Layer2); AbsoluteLayout Layer3 = new AbsoluteLayout(); Layer3.BackgroundColor = Color.Transparent;; AbsoluteLayout.SetLayoutBounds(Layer3, new Rectangle(0, 270, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); // AbsoluteLayout.SetLayoutFlags(Layer3, AbsoluteLayoutFlags.WidthProportional); Label lbl = new Label(); lbl.Text = "Tonnage:"; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer3.Children.Add(lbl); _tonnageEntry = new Entry(); _tonnageEntry.Text = "50"; _tonnageEntry.TextColor = Color.White; _tonnageEntry.BackgroundColor = Color.Gray; _tonnageEntry.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_tonnageEntry, new Rectangle(130, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_tonnageEntry, AbsoluteLayoutFlags.WidthProportional); Layer3.Children.Add(_tonnageEntry); Layer1.Children.Add(Layer3); AbsoluteLayout Layer4 = new AbsoluteLayout(); Layer4.BackgroundColor = Color.Transparent; AbsoluteLayout.SetLayoutBounds(Layer4, new Rectangle(0, 330, 1, 50)); AbsoluteLayout.SetLayoutFlags(Layer4, AbsoluteLayoutFlags.WidthProportional); lbl = new Label(); lbl.Text = "Heat Sinks "; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 1, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer4.Children.Add(lbl); _heatSinksEntry = new Entry(); _heatSinksEntry.TextColor = Color.White; _heatSinksEntry.BackgroundColor = Color.Gray; _heatSinksEntry.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_heatSinksEntry, new Rectangle(75, 0, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(_heatSinksEntry, AbsoluteLayoutFlags.WidthProportional); Layer4.Children.Add(_heatSinksEntry); _heatSinksStepper = new Stepper(); _heatSinksStepper.Minimum = 0; _heatSinksStepper.Maximum = 13; _heatSinksStepper.Increment = 1; _heatSinksStepper.ValueChanged += _heatSinksStepper_ValueChanged; AbsoluteLayout.SetLayoutBounds(_heatSinksStepper, new Rectangle(200, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_heatSinksStepper, AbsoluteLayoutFlags.WidthProportional); Layer4.Children.Add(_heatSinksStepper); Layer1.Children.Add(Layer4); AbsoluteLayout Layer5 = new AbsoluteLayout(); Layer5.BackgroundColor = Color.Transparent;; AbsoluteLayout.SetLayoutBounds(Layer5, new Rectangle(0, 380, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); //AbsoluteLayout.SetLayoutFlags(Layer5, AbsoluteLayoutFlags.WidthProportional); lbl = new Label(); lbl.Text = "Pilot:"; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer5.Children.Add(lbl); _pilotEntry = new Entry(); _pilotEntry.Text = "50"; _pilotEntry.TextColor = Color.White; _pilotEntry.BackgroundColor = Color.Gray; _pilotEntry.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_pilotEntry, new Rectangle(130, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_pilotEntry, AbsoluteLayoutFlags.WidthProportional); Layer5.Children.Add(_pilotEntry); Layer1.Children.Add(Layer5); AbsoluteLayout Layer7 = new AbsoluteLayout(); Layer7.BackgroundColor = Color.Transparent;; AbsoluteLayout.SetLayoutBounds(Layer7, new Rectangle(0, 430, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); //AbsoluteLayout.SetLayoutFlags(Layer7, AbsoluteLayoutFlags.WidthProportional); lbl = new Label(); lbl.Text = "Piloting Skill:"; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer7.Children.Add(lbl); _pilotingSkill = new Entry(); _pilotingSkill.Text = "4"; _pilotingSkill.TextColor = Color.White; _pilotingSkill.BackgroundColor = Color.Gray; _pilotingSkill.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_pilotingSkill, new Rectangle(130, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_pilotingSkill, AbsoluteLayoutFlags.WidthProportional); Layer7.Children.Add(_pilotingSkill); Layer1.Children.Add(Layer7); AbsoluteLayout Layer8 = new AbsoluteLayout(); Layer8.BackgroundColor = Color.Transparent;; AbsoluteLayout.SetLayoutBounds(Layer8, new Rectangle(0, 480, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); //AbsoluteLayout.SetLayoutFlags(Layer8, AbsoluteLayoutFlags.WidthProportional); lbl = new Label(); lbl.Text = "Gunnery Skill:"; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer8.Children.Add(lbl); _gunnerySkill = new Entry(); _gunnerySkill.Text = "4"; _gunnerySkill.TextColor = Color.White; _gunnerySkill.BackgroundColor = Color.Gray; _gunnerySkill.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_gunnerySkill, new Rectangle(130, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_gunnerySkill, AbsoluteLayoutFlags.WidthProportional); Layer8.Children.Add(_gunnerySkill); Layer1.Children.Add(Layer8); AbsoluteLayout Layer9 = new AbsoluteLayout(); Layer9.BackgroundColor = Color.Transparent; AbsoluteLayout.SetLayoutBounds(Layer9, new Rectangle(0, 530, 1, 50)); AbsoluteLayout.SetLayoutFlags(Layer9, AbsoluteLayoutFlags.WidthProportional); lbl = new Label(); lbl.Text = "Hits: "; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 1, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer9.Children.Add(lbl); _hitsEntry = new Entry(); _hitsEntry.TextColor = Color.White; _hitsEntry.BackgroundColor = Color.Gray; _hitsEntry.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_hitsEntry, new Rectangle(75, 0, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(_hitsEntry, AbsoluteLayoutFlags.WidthProportional); Layer9.Children.Add(_hitsEntry); _hitsStepper = new Stepper(); _hitsStepper.Minimum = 0; _hitsStepper.Maximum = 6; _hitsStepper.Increment = 1; _hitsStepper.ValueChanged += _hitsStepper_ValueChanged; AbsoluteLayout.SetLayoutBounds(_hitsStepper, new Rectangle(200, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_hitsStepper, AbsoluteLayoutFlags.WidthProportional); Layer9.Children.Add(_hitsStepper); Layer1.Children.Add(Layer9); AbsoluteLayout Layer10 = new AbsoluteLayout(); Layer10.BackgroundColor = Color.Transparent;; AbsoluteLayout.SetLayoutBounds(Layer10, new Rectangle(0, 580, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); // AbsoluteLayout.SetLayoutFlags(Layer10, AbsoluteLayoutFlags.WidthProportional); lbl = new Label(); lbl.Text = "Consciousness:"; lbl.TextColor = Color.White; lbl.FontSize = 15; AbsoluteLayout.SetLayoutBounds(lbl, new Rectangle(0, 25, 0.25, 50)); AbsoluteLayout.SetLayoutFlags(lbl, AbsoluteLayoutFlags.WidthProportional); Layer10.Children.Add(lbl); _consciousnessEntry = new Entry(); _consciousnessEntry.Text = "0"; _consciousnessEntry.TextColor = Color.White; _consciousnessEntry.BackgroundColor = Color.Gray; _consciousnessEntry.Keyboard = Keyboard.Numeric; AbsoluteLayout.SetLayoutBounds(_consciousnessEntry, new Rectangle(130, 0, 0.75, 50)); AbsoluteLayout.SetLayoutFlags(_consciousnessEntry, AbsoluteLayoutFlags.WidthProportional); Layer10.Children.Add(_consciousnessEntry); Layer1.Children.Add(Layer10); //TODO: Agregar seccion para Weapons AbsoluteLayout Layer11 = new AbsoluteLayout(); Layer11.BackgroundColor = Color.Transparent;; AbsoluteLayout.SetLayoutBounds(Layer11, new Rectangle(0, 630, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); _listWeapons = new ListView(); var template = new DataTemplate(typeof(TextCell)); template.SetBinding(TextCell.TextProperty, "Name"); template.SetValue(TextCell.TextColorProperty, Color.Gray); template.SetBinding(TextCell.DetailProperty, "CurrentAffiliation"); _listWeapons.ItemTemplate = template; //_listWeapons.ItemsSource = db.Table<Weapon>().OrderBy(x => x.Name).ToList(); _listWeapons.ItemSelected += _listView_ItemSelected; _listWeapons.Refreshing += _listView_Refreshing; _listWeapons.SeparatorColor = Color.White; _listWeapons.IsPullToRefreshEnabled = true; Layer11.Children.Add(_listWeapons); Layer1.Children.Add(Layer11); // Lista para mostrar las armas equipadas // Agregar logica para disparar armas con sonido // Agregar logica para almacenar el Heat generado //TODO: Agregar seccion para Heat // Agregar contador para Heat // Agregar logica para calcular Heat restante al restar los HeatSinks // Agregar progress bar para mostrar Heat Actual //TODO: Agregar seccion para mostrar modificadores // Agregar Lista para mostrar los modificadores activos despues de calculo de Heat // Agregar logica para obtener modificadores causados por daño recibido CompressedLayout.SetIsHeadless(Layer1, true); Content = new ScrollView { Content = Layer1 }; }