public override System.Windows.FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            StackPanel mainContainer = new StackPanel();

            mainContainer.Orientation = Orientation.Horizontal;

            //Add an additional element in the cell
            if (cell.DataContext != null)
            {
                Image image = new Image();
                image.Source = new BitmapImage(new Uri(string.Format("/Images/{0}.png", (cell.DataContext as Club).Name), UriKind.RelativeOrAbsolute));
                mainContainer.Children.Add(image);
            }

            //Add HighlightTextBlock to keep the SearchPanel functionality
            HighlightTextBlock htb = new HighlightTextBlock();

            htb.DataType = this.DataType;
            htb.SetBinding(HighlightTextBlock.HighlightTextProperty, new Binding(this.DataMemberBinding.Path.Path));
            cell.SetBinding(GridViewCell.IsHighlightedProperty, new Binding("ContainsMatch")
            {
                Source = htb, Mode = BindingMode.TwoWay
            });
            SetHighlightTextBlockTextProperty(dataItem, htb);
            mainContainer.Children.Add(htb);

            return(mainContainer);
        }
        public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            TextBlock txtBlock = new TextBlock();

            txtBlock.SetBinding(TextBlock.TextProperty, BindingDataSource(dataItem, DataMemberBinding));
            return(txtBlock);
        }
 public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
 {
     try
     {
         cmbCommon = new RadComboBox();
         if (!dataItem.IsNullOrEmpty())
         {
             PropertyInfo property = null;
             object       oObject  = dataItem;
             if (!DieuKienDataMember.IsNullOrEmptyOrSpace())
             {
                 foreach (string str in DieuKienDataMember.Split('.').ToList())
                 {
                     property = oObject.GetType().GetProperty(str);
                     if (property != null)
                     {
                         DieuKien = property.GetValue(oObject, null).ToString();
                         oObject  = property.GetValue(oObject, null);
                     }
                 }
             }
             if (!sMaLoaiDM.Equals(""))
             {
                 lstComboBox = new List <AutoCompleteEntry>();
                 KhoiTaoGiaTriComboBox(ref lstComboBox, ref cmbCommon, sMaLoaiDM);
             }
             if (!GiaTriDataMember.IsNullOrEmptyOrSpace())
             {
                 oObject = dataItem;
                 foreach (string str in GiaTriDataMember.Split('.').ToList())
                 {
                     property = oObject.GetType().GetProperty(str);
                     if (property != null)
                     {
                         GiaTri  = property.GetValue(oObject, null).IsNullOrEmpty() ? "" : property.GetValue(oObject, null).ToString();
                         oObject = property.GetValue(oObject, null);
                     }
                 }
             }
             if (!GiaTri.IsNullOrEmptyOrSpace())
             {
                 cmbCommon.SelectedIndex = lstComboBox.IndexOf(lstComboBox.FirstOrDefault(i => i.KeywordStrings.First().Equals(GiaTri)));
             }
             else
             {
                 cmbCommon.SelectedIndex = -1;
             }
         }
         cmbCommon.Tag               = lstComboBox;
         cmbCommon.IsEnabled         = true;
         cmbCommon.SelectionChanged += new SelectionChangedEventHandler(cmbCommon_SelectionChanged);
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
     cellEdit = cell;
     return(cmbCommon as FrameworkElement);
 }
 public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
 {
     try
     {
         DataRow dr = null;
         if (dataItem.GetType() == typeof(DataRow))
         {
             dr = (DataRow)dataItem;
         }
         else if (dataItem.GetType() == typeof(DataRowView))
         {
             dr = ((DataRowView)dataItem).Row;
         }
         objDataItem = dataItem;
         lstComboBox = new List <AutoCompleteEntry>();
         cmbCommon   = new RadComboBox();
         List <string> lstDieuKien = new List <string>();
         string        sDieuKien   = "";
         string        sGiaTri     = "";
         if (dr.Table.Columns.Contains(DieuKienMemberBinding))
         {
             sDieuKien = dr[DieuKienMemberBinding].ToString();
         }
         else
         {
             sDieuKien = DieuKienMemberBinding;
         }
         if (!GiaTriMemberBinding.IsNullOrEmptyOrSpace() && dr.Table.Columns.Contains(GiaTriMemberBinding))
         {
             sGiaTri = dr[GiaTriMemberBinding].ToString();
         }
         lstDieuKien.Add(sDieuKien.ToString());
         if (!truyvanMemberBinding.IsNullOrEmptyOrSpace())
         {
             if (dr.Table.Columns.Contains(truyvanMemberBinding))
             {
                 sTruyVan = dr[truyvanMemberBinding].ToString();
             }
         }
         if (!sTruyVan.Equals(""))
         {
             KhoiTaoGiaTriComboBox(ref lstComboBox, ref cmbCommon, sTruyVan, lstDieuKien);
         }
         if (!sGiaTri.IsNullOrEmptyOrSpace())
         {
             cmbCommon.SelectedIndex = lstComboBox.IndexOf(lstComboBox.FirstOrDefault(i => i.KeywordStrings.First().Equals(sGiaTri)));
         }
         else
         {
             cmbCommon.SelectedIndex = -1;
         }
         cmbCommon.IsEnabled = false;
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
     return(cmbCommon);
 }
        public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            RadMaskedNumericInput radMask = new RadMaskedNumericInput();

            radMask.SetBinding(RadMaskedNumericInput.ValueProperty, CreateValueBinding(dataItem));
            radMask.Mask = Mask;
            radMask.HorizontalAlignment = HorizontalAlignment.Stretch;
            return(radMask);
        }
Beispiel #6
0
        public override System.Windows.FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            if (!(cell.Content is TextBlock textBlock))
            {
                textBlock = new TextBlock();
            }

            textBlock.Text = (this.DataControl.Items.IndexOf(dataItem) + 1).ToString();
            return(textBlock);
        }
        public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            Binding newBinding = CreateValueBinding();

            if (LObject.IsNullOrEmpty(newBinding.Source))
            {
                newBinding.Source = dataItem;
            }
            this.SetBinding(ColumnsMaskDateTime.ValueProperty, newBinding);
            Grid gridPanel = new Grid();
            RadMaskedDateTimeInput radMask    = new RadMaskedDateTimeInput();
            DatePicker             datePicker = new DatePicker();
            Binding datePickerBinding         = new Binding();

            datePickerBinding.Mode = BindingMode.TwoWay;
            datePickerBinding.NotifyOnValidationError = true;
            datePickerBinding.ValidatesOnExceptions   = true;
            datePickerBinding.UpdateSourceTrigger     = UpdateSourceTrigger.Explicit;
            datePickerBinding.Source = radMask;
            datePickerBinding.Path   = new PropertyPath(RadMaskedDateTimeInput.ValueProperty);
            datePicker.SetBinding(DatePicker.SelectedDateProperty, datePickerBinding);
            datePicker.IsTabStop = false;
            if (!LObject.IsNullOrEmpty(Value))
            {
                radMask.Value = LDateTime.StringToDate(Value, ApplicationConstant.defaultDateTimeFormat);
            }
            else
            {
                radMask.Value = DefaultValue;
            }
            if (!Mask.IsNullOrEmptyOrSpace())
            {
                radMask.Mask = Mask;
            }
            radMask.HorizontalAlignment  = HorizontalAlignment.Stretch;
            radMask.IsClearButtonVisible = false;
            var ControlDate = gridPanel.FindChildByType <RadMaskedDateTimeInput>();

            if (ControlDate == null)
            {
                gridPanel.Children.Add(radMask);
            }
            if (VisibilityCalendar)
            {
                radMask.Margin = new Thickness(0, 0, 35, 0);
                datePicker.HorizontalAlignment = HorizontalAlignment.Right;
                datePicker.Width = 30;
                var ControlDatePicker = gridPanel.FindChildByType <DatePicker>();
                if (ControlDatePicker == null)
                {
                    gridPanel.Children.Add(datePicker);
                }
            }
            return(gridPanel);
        }
Beispiel #8
0
        public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            RadComboBox cmbCommon = new RadComboBox();

            try
            {
            }
            catch (Exception ex)
            {
            }
            return(cmbCommon as FrameworkElement);
        }
 public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
 {
     teldtCommon = new RadMaskedDateTimeInput();
     try
     {
         teldtCommon.IsEnabled = false;
         teldtCommon.SetBinding(RadMaskedDateTimeInput.ValueProperty, DataMemberBinding);
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
     return(teldtCommon);
 }
        public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            try
            {
                cmbCommon = new RadComboBox();
                if (lstComboBox != null || lstComboBox.Count > 0)
                {
                    new AutoComboBox().GenAutoComboBox(ref lstComboBox, ref cmbCommon, null, null, giaTri);
                }
                else
                {
                    if (!dataItem.IsNullOrEmpty())
                    {
                        PropertyInfo property = null;
                        if (!DieuKienDataMember.IsNullOrEmptyOrSpace())
                        {
                            property = dataItem.GetType().GetProperty(DieuKienDataMember);
                            if (property != null)
                            {
                                DieuKien = property.GetValue(dataItem, null).ToString();
                            }
                        }
                        property = dataItem.GetType().GetProperty(GiaTriDataMember);
                        if (property != null)
                        {
                            GiaTri      = property.GetValue(dataItem, null).ToString();
                            lstComboBox = new List <AutoCompleteEntry>();

                            List <string> lstDieuKien = new List <string>();
                            lstDieuKien.Add(DieuKien.ToString());
                            if (!sTruyVan.Equals(""))
                            {
                                KhoiTaoGiaTriComboBox(ref lstComboBox, ref cmbCommon, sTruyVan, lstDieuKien);
                            }
                            cmbCommon.SelectedIndex = lstComboBox.IndexOf(lstComboBox.FirstOrDefault(i => i.KeywordStrings.First().Equals(GiaTri)));
                            cmbCommon.Tag           = lstComboBox;
                        }
                    }
                }
                cmbCommon.IsEnabled         = true;
                cmbCommon.IsEditable        = true;
                cmbCommon.SelectionChanged += new SelectionChangedEventHandler(cmbCommon_SelectionChanged);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            cellEdit = cell;
            return(cmbCommon as FrameworkElement);
        }
Beispiel #11
0
 public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
 {
     try
     {
         cmbCommon = new RadComboBox();
         if (!dataItem.IsNullOrEmpty())
         {
             PropertyInfo property = null;
             object       oObject  = dataItem;
             if (!DieuKienDataMember.IsNullOrEmptyOrSpace())
             {
                 foreach (string str in DieuKienDataMember.Split('.').ToList())
                 {
                     property = oObject.GetType().GetProperty(str);
                     if (property != null)
                     {
                         DieuKien = property.GetValue(oObject, null).ToString();
                         oObject  = property.GetValue(oObject, null);
                     }
                 }
             }
             if (!sTruyVan.Equals(""))
             {
                 List <string> lstDieuKien = new List <string>();
                 lstDieuKien.Add(DieuKien.ToString());
                 lstComboBox = new List <AutoCompleteEntry>();
                 KhoiTaoGiaTriComboBox(ref lstComboBox, ref cmbCommon, sTruyVan, lstDieuKien);
             }
             if (!GiaTriDataMember.IsNullOrEmptyOrSpace())
             {
                 this.SetBinding(GiaTriProperty, CreateValueBinding(dataItem));
             }
             if (!GiaTri.IsNullOrEmptyOrSpace())
             {
                 cmbCommon.SelectedIndex = lstComboBox.IndexOf(lstComboBox.FirstOrDefault(i => i.KeywordStrings.First().Equals(GiaTri)));
             }
             else
             {
                 cmbCommon.SelectedIndex = -1;
             }
         }
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
     cmbCommon.IsEnabled = false;
     return(cmbCommon);
 }
        public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            RadMaskedDateTimeInput txtbCommon = new RadMaskedDateTimeInput();

            try
            {
                txtbCommon.Mask = "dd/MM/yyyy";
                txtbCommon.SetBinding(RadMaskedDateTimeInput.ValueProperty, DataMemberBinding);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            cellEdit = cell;
            return(txtbCommon as FrameworkElement);
        }
        public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            Binding newBinding = CreateValueBinding();

            if (LObject.IsNullOrEmpty(newBinding.Source))
            {
                newBinding.Source = dataItem;
            }
            this.SetBinding(ColumnsMaskDateTime.ValueProperty, newBinding);
            TextBlock txt = new TextBlock();

            if (!LObject.IsNullOrEmpty(Value))
            {
                txt.Text = LDateTime.StringToDate(Value, ApplicationConstant.defaultDateTimeFormat).ToString(Mask);
            }
            return(txt);
        }
Beispiel #14
0
        public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
        {
            TextBlock txtBlock = new TextBlock();

            try
            {
                if (LObject.IsNullOrEmpty(DataMemberBinding))
                {
                    DataMemberBinding = new Binding();
                }
                if (LObject.IsNullOrEmpty(DataMemberBinding.Source))
                {
                    DataMemberBinding.Source = dataItem;
                }
                if (LObject.IsNullOrEmpty(DieuKienDataBinding))
                {
                    DieuKienDataBinding = new Binding();
                }
                if (LObject.IsNullOrEmpty(DieuKienDataBinding.Source))
                {
                    DieuKienDataBinding.Source = dataItem;
                }
                this.SetBinding(ColumnsComboBoxv3.DieuKienProperty, DieuKienDataBinding);
                this.SetBinding(ColumnsComboBoxv3.GiaTriProperty, DataMemberBinding);
                if (!LObject.IsNullOrEmpty(TruyVan))
                {
                }
                if (!LObject.IsNullOrEmpty(DieuKien))
                {
                }
                if (!LObject.IsNullOrEmpty(GiaTri))
                {
                    txtBlock.Text = GiaTri;
                }
            }
            catch (Exception ex)
            {
            }
            return(txtBlock);
        }
 public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
 {
     cellCurrent = cell;
     return(CreateGrid(dataItem));
 }