public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { this.BindingTarget = GenericDateTimePicker.SelectedDateTimeProperty; var picker = new GenericDateTimePicker(); picker.SetBinding(this.BindingTarget, this.CreateValueBinding()); return picker; }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { var slider = new RadSlider(); slider.Maximum = 0; slider.Maximum = 100; slider.SmallChange = 1; slider.LargeChange = 10; slider.SetBinding(RadSlider.ValueProperty, this.DataMemberBinding); return slider; }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { this.BindingTarget = RadDateTimePicker.SelectedValueProperty; RadDateTimePicker picker = new RadDateTimePicker(); picker.IsTooltipEnabled = false; picker.TimeInterval = this.TimeInterval; picker.SetBinding(this.BindingTarget, this.CreateValueBinding()); return picker; }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { BindingTarget = RadDateTimePicker.SelectedValueProperty; RadDateTimePicker picker = new RadDateTimePicker(); TouchManager.SetIsTouchHitTestVisible(picker, false); picker.IsTooltipEnabled = false; picker.InputMode = InputMode.DatePicker; picker.TimeInterval = TimeInterval; picker.SetBinding(BindingTarget, CreateValueBinding()); return picker; }
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem) { var bar = cell.Content as RadProgressBar; if (bar == null) { bar = new RadProgressBar(); bar.Height = 20; bar.SetBinding(RadProgressBar.ValueProperty, this.DataMemberBinding); cell.Content = bar; } return bar; }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { this.SetBinding(ColumnsMaskDateTime.ValueProperty, CreateValueBinding(dataItem)); this.BindingTarget = RadDateTimePicker.SelectedValueProperty; RadDatePicker picker = new RadDatePicker(); picker.IsTooltipEnabled = false; picker.TimeInterval = this.TimeInterval; picker.DisplayFormat = DateTimePickerFormat.Short; //picker.SetBinding(this.BindingTarget, this.CreateValueBinding()); picker.SetBinding(this.BindingTarget, CreateValueBinding(dataItem)); return(picker); }
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem) { RadButton button = cell.Content as RadButton; if (button == null) { button = new RadButton(); System.Windows.Controls.Image btnimage = new System.Windows.Controls.Image(); btnimage.ToolTip = this.ToolTip; btnimage.Height = 16; btnimage.Width = 16; btnimage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(ImageSource, UriKind.Relative)); button.Width = 25; button.Content = btnimage; button.Click += button_Click; } return(button); }
private void RadContextMenu_Opened(object sender, RoutedEventArgs e) { RadContextMenu menu = (RadContextMenu)sender; GridViewRow row = menu.GetClickedElement <GridViewRow>(); if (row != null) { row.IsSelected = row.IsCurrent = true; GridViewCell cell = menu.GetClickedElement <GridViewCell>(); if (cell != null) { cell.IsCurrent = true; } } else { menu.IsOpen = false; } }
private void RadContextMenu_Opened(object sender, RoutedEventArgs e) { RadContextMenu menu = (RadContextMenu)sender; GridViewRow row = menu.GetClickedElement <GridViewRow>(); GroupHeaderRow groupHeaderRow = menu.GetClickedElement <GroupHeaderRow>(); if (row != null && !row.IsInEditMode) { menu.Items.Clear(); RadMenuItem item = new RadMenuItem(); item.Header = "Add"; menu.Items.Add(item); item = new RadMenuItem(); item.Header = "Edit"; menu.Items.Add(item); item = new RadMenuItem(); item.Header = "Delete"; menu.Items.Add(item); row.IsSelected = row.IsCurrent = true; GridViewCell cell = menu.GetClickedElement <GridViewCell>(); if (cell != null) { cell.IsCurrent = true; } } else if (groupHeaderRow != null) { menu.Items.Clear(); RadMenuItem item = new RadMenuItem(); item.Header = "Delete"; menu.Items.Add(item); } else { menu.IsOpen = false; } }
private FrameworkElement GetCellContent(GridViewCell cell, object dataItem) { Type myType = dataItem.GetType(); IList <PropertyInfo> props = new List <PropertyInfo>(myType.GetProperties()); var colorProp = props.FirstOrDefault(x => x.Name == this.DataMemberBinding.Path.Path); if (colorProp != null) { var valueColor = colorProp.GetValue(dataItem); RadColorPicker colorPicker = new RadColorPicker(); if (valueColor != null && valueColor.ToString() != "") { colorPicker.SelectedColor = (Color)System.Windows.Media.ColorConverter.ConvertFromString(valueColor.ToString()); } colorPicker.SelectedColorChanged += (sender1, e1) => ColorPicker_SelectedColorChanged(sender1, e1, colorProp, dataItem); return(colorPicker); // Grid grid = new Grid(); // grid.HorizontalAlignment = HorizontalAlignment.Stretch; // grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(30) }); // grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength() }); // var button = new Button(); // button.Content = "..."; // var textBlock = new TextBlock(); //textBlock.Width = 50; // textBlock.HorizontalAlignment = HorizontalAlignment.Stretch; // if (valueColor != null && valueColor.ToString() != "") // { // System.Windows.Media.Color color = (Color)System.Windows.Media.ColorConverter.ConvertFromString(valueColor.ToString()); // var colorBrush = new SolidColorBrush(color); // textBlock.Background = colorBrush; // } // button.Click += (sender, e) => Button_Click(sender, e, textBlock, colorProp, dataItem, textBlock.Background as SolidColorBrush); // grid.Children.Add(button); // Grid.SetColumn(textBlock, 1); // grid.Children.Add(textBlock); // return grid; } return(null); }
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem) { RadButton button = cell.Content as RadButton; if (button == null) { button = new RadButton(); button.Content = "Editar"; //button.Command = RadGridViewCommands.Search; if (this.btnRoutedClickEvent != null) { button.Click += this.btnRoutedClickEvent; // new RoutedEventHandler(btnClickEvent); // Button_Click; } } button.CommandParameter = dataItem; return(button); }
void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e) { GridViewCell cell = e.Cell; //isValid = IsValidInventoryRange(e.NewValue); var viewmodel = ViewModelManager.GetViewModel <TransferRequestViewModel, TransferRequestsView>(); var qty = (decimal)0.0; string validationText = ""; bool isValid = false; if (decimal.TryParse(e.NewValue.ToString(), out qty)) { qty = e.NewValue != null ? (decimal)e.NewValue : 0; var rangeMessage = TransferRequestHelper.GetInventoryRange(viewmodel.SelectedDetail.ItemCode, qty); isValid = (string.IsNullOrEmpty(rangeMessage.Item1)) || viewmodel.ConfirmDialog(rangeMessage.Item1, "Alerta inventario"); validationText = rangeMessage.Item2; if (!isValid) { validationText += "\n Porfavor ingrese un valor valido"; } if (!isValid) { this.MarkCell(cell, validationText); } else { this.RestoreCell(cell); } } else { validationText = "Ingrese un valor valido"; } e.ErrorMessage = validationText; e.IsValid = isValid; }
private void gvData_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) { int countC = e.Row.Cells.Count; for (int i = 0; i < countC; i++) { var _cell = e.Row.Cells[i]; if (_cell.DataContext.ToString() == "System.Data.DataRow") { GridViewCell _cellValid = (GridViewCell)e.Row.Cells[i]; if (_cellValid.Value == null) { var converter = new System.Windows.Media.BrushConverter(); var brush = (Brush)converter.ConvertFromString("#D32F2F"); e.Row.Cells[i].Background = brush; } } } }
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem) { StringBuilder sb = new StringBuilder(); foreach (string workingDay in ((Person)dataItem).WorkingDays) { sb.AppendFormat("{0}, ", workingDay); } if (sb.Length > 0) { sb.Remove(sb.Length - 2, 2); } TextBlock textBlock = (TextBlock)base.CreateCellElement(cell, dataItem); textBlock.Text = sb.ToString(); return(textBlock); }
private void gvData_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e) { DAL.Datos datos = new DAL.Datos(); GridViewCell cl = (GridViewCell)e.Cell; TextBox t = (TextBox)e.EditingElement; Int32 c = e.Cell.TabIndex; GridViewCell _id = (GridViewCell)e.Cell.ParentRow.Cells[0]; RadGridView _gv = (RadGridView)e.Source; string _columnHeader = _gv.CurrentColumn.Header.ToString(); datos.UpdateRequerido(nameBD, _id.Value.ToString(), _columnHeader, t.Text); //gvData.Rebind(); //datos.ObtenerRequerido(sNombre).Tables[0]; //MessageBox.Show(_id.Value.ToString()); }
void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e) { GridViewCell cell = e.Cell; //isValid = IsValidInventoryRange(e.NewValue); var qty = (decimal)0.0; string validationText = ""; bool isValid = false; if (decimal.TryParse(e.NewValue.ToString(), out qty)) { qty = e.NewValue != null ? (decimal)e.NewValue : 0; isValid = qty >= 0; if (!isValid) { validationText += "\n Porfavor ingrese un valor valido"; } if (!isValid) { this.MarkCell(cell, validationText); } else { this.RestoreCell(cell); } } else { validationText = "Ingrese un valor valido"; } e.ErrorMessage = validationText; e.IsValid = isValid; }
//void control_TemporaryDisplayViewRequested(object sender, Arg_TemporaryDisplayViewRequested e) //{ // TemporaryArg.OnTemporaryViewRequested(sender, e); //} public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { I_ControlHelper MyControlHelper = null; if (HasRangeOfValues) { MyControlHelper = ControlHelper.KeyValueControlHelper(Column); } else { MyControlHelper = ControlHelper.GetControlHelper(Column, ColumnSetting, null); } if (MyControlHelper is I_ControlHelperValueRange) { if (ColumnValueRange != null) { (MyControlHelper as I_ControlHelperValueRange).SetColumnValueRange(ColumnValueRange); } } return(MyControlHelper.WholeControl); }
public override Style SelectStyle(object item, DependencyObject container) { //return base.SelectStyle(item, container); if (item is DataRow) { GridViewCell cell = container as GridViewCell; DataRow row = item as DataRow; if (row["INDUSTRY"].ToString() == "") { return(SectorStyle); } else if (row["Isin"].ToString() == "") { return(IndustryStyle); } try { if (row["ESG"].ToString().CompareTo("EXCLU") == 0) { GlobalInfos.rowESGExclu.Add(row.ItemArray[0].ToString()); } } catch { } if (GlobalInfos.rowESGExclu.Contains(row.ItemArray[0])) { return(ESGExcluStyle); } } return(null); }
public override Style SelectStyle(object item, DependencyObject container) { if (item is BaseDataModel) { GridViewCell cell = container as GridViewCell; var currentColumn = cell.Column as GridViewDataColumn; string key = currentColumn.DataMemberBinding.Path.Path; if (Rules.ContainsKey(key)) { foreach (CellStyleRule rule in Rules[key]) { // string debug = DebugHelper.Debug(rule.Condition); // REVERTED NOTE - if just Func<> // if (rule.Condition((BaseDataModel)item)) // NOTE - if Expression<Func<>>, first compile then pass in param if (rule.Condition.Compile()((BaseDataModel)item)) { return(rule.Style); } } } } return(null); }
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { return(GetCellContent(cell, dataItem)); }
void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e) { bool isValid = true; string validationText = "Validation failed. "; GridViewCell cell = e.Cell; switch (cell.Column.UniqueName) { case "ContactName": isValid = ValidateName((string)e.NewValue); if (!isValid) { validationText += "The name of the customer may contain only Latin letters" + Environment.NewLine + "and empty spaces and must start with a letter."; } break; //case "Country": // isValid = this.ValidateCountry((string)e.NewValue); // if (!isValid) // { // validationText += "The name of the country must match the name of an existing one."; // } // break; case "Phone": isValid = ValidatePhone((string)e.NewValue); if (!isValid) { validationText += "The phone must be in one of the formats X.X.X.X, Y or (X) Y, where " + Environment.NewLine + "X is a random sequence of numerals and Y is a random sequence of numerals, " + Environment.NewLine + "empty spaces and '-', which starts and ends with a numeral."; } break; case "PostalCode": isValid = ValidatePostalCode(e.NewValue); if (!isValid) { validationText += "The postal code of the customer must not be empty."; } break; // Truongnx add case "AccountName": isValid = ValidateAccountName((string)e.NewValue); if (!isValid) { validationText += "The account name must not be empty."; } break; case "AccountNo": isValid = ValidateAccountNo((string)e.NewValue); if (!isValid) { validationText += "The account number must not be empty and must be in range 0-9."; } break; case "BankCode": isValid = ValidateBank((string)e.NewValue); if (!isValid) { validationText += "The bank must not be empty."; } break; case "Branch": isValid = ValidateBranch((string)e.NewValue); if (!isValid) { validationText += "The branch must not be empty."; } break; } if (!isValid) { this.MarkCell(cell, validationText); } else { this.RestoreCell(cell); } e.ErrorMessage = validationText; e.IsValid = isValid; }
void GridView_CellValidating(object sender, GridViewCellValidatingEventArgs e) { bool isValid = true; //string hinhThucTT = ""; //string validationText = "Validation failed. "; string validationText = "Giá trị không phù hợp. "; GridViewCell cell = e.Cell; Grid grid = null; switch (cell.Column.UniqueName) { case "ContactName": isValid = ValidateName((string)e.NewValue); if (!isValid) { validationText += "The name of the customer may contain only Latin letters" + Environment.NewLine + "and empty spaces and must start with a letter."; } break; case "Country": isValid = this.ValidateCountry((string)e.NewValue); if (!isValid) { validationText += "The name of the country must match the name of an existing one."; } break; case "Phone": isValid = ValidatePhone((string)e.NewValue); if (!isValid) { validationText += "The phone must be in one of the formats X.X.X.X, Y or (X) Y, where " + Environment.NewLine + "X is a random sequence of numerals and Y is a random sequence of numerals, " + Environment.NewLine + "empty spaces and '-', which starts and ends with a numeral."; } break; case "PostalCode": isValid = ValidatePostalCode(e.NewValue); if (!isValid) { validationText += "The postal code of the customer must not be empty."; } break; // Truongnx add case "SO_CTU": isValid = ValidateSO_CTU((string)e.NewValue); if (!isValid) { validationText += "Số chứng từ không được để trống."; } break; //case "NGAY_CTU": //isValid = ValidateNGAY_CTU((string)e.NewValue); //if (!isValid) //{ // validationText += "Ngày chứng từ không được để trống."; //} //break; //grid = e.EditingElement as Grid; //RadDatePicker rdp = grid.FindChildByType<RadDatePicker>(); //if (rdp != null && rdp.SelectedDate != null) //{ // isValid = ValidateNGAY_CTU(rdp.SelectedDate.GetValueOrDefault().ToString("dd/MM/yyyy")); // if (!isValid) // { // validationText += "Ngày chứng từ không được để trống."; // } //} //else if (rdp.SelectedDate == null) //{ // isValid = false; // if (!isValid) // { // validationText += "Ngày chứng từ không được để trống."; // } //} //break; //case "GIA_TRI": // isValid = ValidateGIA_TRI(((decimal)e.NewValue).ToString()); // if (!isValid) // { // validationText += "Giá trị nguyên giá không được để trống và chỉ là các ký tự số."; // } // break; //case "TKHOAN_TTOAN": // grid = e.EditingElement as Grid; // TextBox txt = grid.FindChildByType<TextBox>(); // if (txt != null) // { // isValid = ValidateTKHOAN_TTOAN((string)txt.Text); // if (!isValid) // { // validationText += "Tài khoản thanh toán không được để trống và chỉ là các ký tự số."; // } // } // break; } if (!isValid) { this.MarkCell(cell, validationText); } else { this.RestoreCell(cell); } e.ErrorMessage = validationText; e.IsValid = isValid; }
public override Style SelectStyle(object item, DependencyObject container) { if (item is DataRow) { GridViewCell cell = container as GridViewCell; DataRow row = item as DataRow; if (cell.Column.Header.ToString() == "Q") { switch (row["Q"].ToString()) { case "1": return(StyleClassement1); case "2": return(StyleClassement2); case "3": return(StyleClassement3); case "4": return(StyleClassement4); case "5": return(StyleClassement5); } } if (row["Label_Industry"].ToString() == "") { if (GlobalInfos.isEurope) { if (row["RecoMXEU"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlusIndustry); } if (row["RecoMXEUM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlusIndustry); } if (row["RecoMXEM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlusIndustry); } if (row["RecoMXEU"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlusPlusIndustry); } if (row["RecoMXEUM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlusPlusIndustry); } if (row["RecoMXEM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlusPlusIndustry); } if (row["RecoMXEU"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoMinusIndustry); } if (row["RecoMXEUM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoMinusIndustry); } if (row["RecoMXEM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoMinusIndustry); } if (cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoSector); } if (cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoSector); } if (cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoSector); } } else { if (row["RecoMXUSLC"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlusIndustry); } if (row["RecoMXUSLC"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlusPlusIndustry); } if (row["RecoMXUSLC"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoMinusIndustry); } if (cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoSector); } } return(StyleSector); } if (row["ISIN"].ToString() == "") { if (GlobalInfos.isEurope) { if (row["RecoMXEU"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlusIsin); } if (row["RecoMXEUM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlusIsin); } if (row["RecoMXEM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlusIsin); } if (row["RecoMXEU"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlusPlusIsin); } if (row["RecoMXEUM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlusPlusIsin); } if (row["RecoMXEM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlusPlusIsin); } if (row["RecoMXEU"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoMinusIsin); } if (row["RecoMXEUM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoMinusIsin); } if (row["RecoMXEM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoMinusIsin); } if (cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoIndustry); } if (cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoIndustry); } if (cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoIndustry); } } else { if (row["RecoMXUSLC"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlusIsin); } if (row["RecoMXUSLC"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlusPlusIsin); } if (row["RecoMXUSLC"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoMinusIsin); } if (cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoIndustry); } } return(StyleIndustry); } if (GlobalInfos.isEurope) { if (row["RecoMXEU"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlus); } if (row["RecoMXEUM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlus); } if (row["RecoMXEM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlus); } if (row["RecoMXEU"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlus); } if (row["RecoMXEUM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlus); } if (row["RecoMXEM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlus); } if (row["RecoMXEU"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoMinus); } if (row["RecoMXEUM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoMinus); } if (row["RecoMXEM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoMinus); } if (cell.Column.Header.ToString() == "RecoMXEU") { return(StyleReco); } if (cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleReco); } if (cell.Column.Header.ToString() == "RecoMXEM") { return(StyleReco); } } else { if (row["RecoMXUSLC"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlus); } if (row["RecoMXUSLC"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlus); } if (row["RecoMXUSLC"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoMinus); } if (cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleReco); } } } return(null); }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { //var gridViewCell = viewType == 0 ? // Element.ItemTemplate.CreateContent() as JWChinese.GridViewCell : // Element.GroupHeaderTemplate.CreateContent() as JWChinese.GridViewCell; var gridViewCell = viewType == 0 ? Element.ItemTemplate.CreateContent() as ViewCell : Element.GroupHeaderTemplate.CreateContent() as ViewCell; // reflection method of setting isplatformenabled property // We are going to re-set the Platform here because in some cases (headers mostly) its possible this is unset and // when the binding context gets updated the measure passes will all fail. By applying this here the Update call // further down will result in correct layouts. try { var p = PlatformProperty.GetValue(Element); PlatformProperty.SetValue(gridViewCell, p); } catch (Exception e) { } var initialCellSize = new Xamarin.Forms.Size(Element.MinItemWidth, Element.RowHeight); var view = new GridViewCellContainer(parent.Context, gridViewCell, parent, initialCellSize); //Only add the click handler for items (not group headers.) if (viewType == 0) { view.Click += mMainView_Click; view.LongClickable = true; } //Height of the view will be taken as RowHeight for child items //and the heightrequest property of the first view in the template //or the render height (whatever that is) if the heightrequest property is not defined. var height = viewType == 0 ? Convert.ToInt32(Element.RowHeight) : gridViewCell.View.HeightRequest != -1 ? Convert.ToInt32(gridViewCell.View.HeightRequest) : Convert.ToInt32(gridViewCell.RenderHeight); var width = Convert.ToInt32(Element.MinItemWidth); var dpW = ConvertDpToPixels(width); var dpH = ConvertDpToPixels(height); //If there are no minimums then the view doesn't render at all. view.SetMinimumWidth(dpW); view.SetMinimumHeight(dpH); var d = Resources.System.GetDrawable("statelist_item_background.xml"); view.SetBackground(d); //If not set to match parent then the view doesn't stretch to fill. //This is not necessary anymore with the plaform fix above. //view.LayoutParameters = new GridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); //Wrap the view. GridViewCell myView = new GridViewCell(view); //return the view. return(myView); }
public override Style SelectStyle(object item, DependencyObject container) { if (item is DataRow) { GridViewCell cell = container as GridViewCell; DataRow row = item as DataRow; if (cell.Column.Header.ToString() == "Note") { if (GlobalInfos.tickerQuintQaunt.ContainsKey(row["TICKER"].ToString())) { int quint = GlobalInfos.tickerQuintQaunt[row["TICKER"].ToString()]; switch (quint) { case (1): return(StyleLimeGreen); case (2): return(StyleLightGreen); case (3): return(StyleWhite); case (4): return(StyleLightGray); case (5): return(StyleDimGray); } } } else if (cell.Column.Header.ToString() == "note ISR") { return(StyleLightGreen); } else if (cell.Column.Header.ToString() == "Value") { return(StyleLightSlateGray); } else if (cell.Column.Header.ToString() == "Profit") { return(StyleLightCoral); } else if (cell.Column.Header.ToString() == "Growth") { return(StyleLightBlue); } else if (cell.Column.Header.ToString() == "ISR") { return(StyleLightGreen); } else if (cell.Column.Header.ToString() == "EPS_CHG_NTM" || cell.Column.Header.ToString() == "SALES_CHG_NTM") { return(StyleLightBlue); } else if (cell.Column.Header.ToString() == "EBIT_MARGIN_NTM" || cell.Column.Header.ToString() == "NET_DEBT_EBITDA_NTM" || cell.Column.Header.ToString() == "ROE_NTM" || cell.Column.Header.ToString() == "PBT_SALES_NTM" || cell.Column.Header.ToString() == "PBT_RWA_NTM" || cell.Column.Header.ToString() == "COST_INCOME_NTM" || cell.Column.Header.ToString() == "ROTE_NTM") { return(StyleLightCoral); } else if (cell.Column.Header.ToString() == "PE_NTM" || cell.Column.Header.ToString() == "PB_NTM" || cell.Column.Header.ToString() == "DIV_YLD_NTM" || cell.Column.Header.ToString() == "PE_ON_MED5Y" || cell.Column.Header.ToString() == "PE_PREMIUM_ON_HIST" || cell.Column.Header.ToString() == "PB_ON_MED5Y" || cell.Column.Header.ToString() == "PB_PREMIUM_ON_HIST" || cell.Column.Header.ToString() == "P_TBV_NTM" || cell.Column.Header.ToString() == "P_TBV_ON_MED5Y") { return(StyleLightSlateGray); } else if (cell.Column.Header.ToString() == "EPS_TREND" || cell.Column.Header.ToString() == "EPS_VAR_RSD" || cell.Column.Header.ToString() == "SALES_TREND" || cell.Column.Header.ToString() == "SALES_VAR_RSD") { return(StyleLightBlue); } else if (cell.Column.Header.ToString() == "FCF_TREND") { return(StyleLightCoral); } return(null); } return(null); }
public override Style SelectStyle(object item, DependencyObject container) { if (item is DataRow) { GridViewCell cell = container as GridViewCell; DataRow row = item as DataRow; if (row["RecoMXEU"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlus); } if (row["RecoMXEUM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlus); } if (row["RecoMXEM"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlus); } if (row["RecoMXEU"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoPlus); } if (row["RecoMXEUM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoPlus); } if (row["RecoMXEM"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoPlus); } if (row["RecoMXEU"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEU") { return(StyleRecoMinus); } if (row["RecoMXEUM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleRecoMinus); } if (row["RecoMXEM"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXEM") { return(StyleRecoMinus); } if (cell.Column.Header.ToString() == "RecoMXEU") { return(StyleReco); } if (cell.Column.Header.ToString() == "RecoMXEUM") { return(StyleReco); } if (cell.Column.Header.ToString() == "RecoMXEM") { return(StyleReco); } if (row["RecoMXUSLC"].ToString() == "+" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlus); } if (row["RecoMXUSLC"].ToString() == "++" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoPlus); } if (row["RecoMXUSLC"].ToString() == "-" && cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleRecoMinus); } if (cell.Column.Header.ToString() == "RecoMXUSLC") { return(StyleReco); } } return(null); }
private void OnDoubleClick(object sender, Telerik.Windows.RadRoutedEventArgs e) { GridViewCell cell = (GridViewCell)sender; MessageBox.Show(cell.Content.ToString()); }