public MatrixCellControl(string cellTitle, Color cellColor, TreeMapItem item) { BackgroundColor = cellColor; _cellColor = cellColor; InnerItem = item; var grd = new Grid () { RowSpacing = 0 }; grd.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto }); grd.RowDefinitions.Add (new RowDefinition ()); { _cnvTitle = new ContentView () { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill }; var lblTitle = new Label () { Text = cellTitle, TextColor = Color.White, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center, FontSize = Device.OnPlatform (10, 11, 10) }; _cnvTitle.Content = lblTitle; grd.Children.Add (_cnvTitle); } { var cnvBorder = new ContentView () { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Padding = Device.OnPlatform (2, new Thickness (2, 1, 2, 2), 2) }; var cnvColor = new BoxView () { BackgroundColor = cellColor }; cnvBorder.Content = cnvColor; Grid.SetRow (cnvBorder, 1); grd.Children.Add (cnvBorder); } ; Content = grd; }
public bool UpdateSelectedItem (TreeMapItem selectedItem) { var result = false; if (selectedItem == null) { SelectedMatrixItem = null; } else { if (SelectedMatrixItem != null) { if (SelectedMatrixItem.ItemCode.Equals (selectedItem.ItemCode)) { SelectedMatrixItem = null; } else { SelectedMatrixItem = selectedItem; result = true; } } else { SelectedMatrixItem = selectedItem; result = true; } } return result; }
public MatrixCellControlPrototype(string cellTitle, Color cellColor, TreeMapItem item) { InitializeComponent (); // CommandsInit (); // // _singleTapAction = singleTapAction; // _doubleTapAction = doubleTapAction; lblTitle.Text = cellTitle; BackgroundColor = cellColor; cnvColor.BackgroundColor = cellColor; _cellColor = cellColor; InnerItem = item; cnvBorder.Padding = Device.OnPlatform (2,new Thickness(1,1,2,2),2); // gestSingle.GestureCommand = SingleTapCommand; // gestDouble.GestureCommand = DoubleTapCommand; //cnvGesture.GestureRecognized += OnCellGesture; }
private Color GetItemColor(TreeMapItem item) { var result = Color.Transparent; if (item.ColorValue < -0.5) { result = _redColor; } else if (item.ColorValue > 0.5) { result = _yellowColor; } else { result = _greenColor; } return result; }