private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.Property.Name == "CountryId")
     {
         _colCountry.DisplayMemberPath = "Name";
         _colCountry.SelectedValuePath = "Id";
         _colCountry.SortMemberPath    = "CountryId";
         _colCountry.FilterMemberPath  = "CountryId";
         _colCountry.Header            = "Country";
         _colCountry.Binding           = new Binding()
         {
             Path = new PropertyPath("CountryId"), Mode = BindingMode.TwoWay
         };
         _colCountry.ItemsSource = Country.AllCountries;
         e.Column = _colCountry;
     }
     else if (e.Property.Name == "RegionId")
     {
         _colRegion.DisplayMemberPath = "Name";
         _colRegion.SelectedValuePath = "Id";
         _colRegion.SortMemberPath    = "RegionId";
         _colRegion.FilterMemberPath  = "RegionId";
         _colRegion.Header            = "Region";
         _colRegion.Binding           = new Binding()
         {
             Path = new PropertyPath("RegionId"), Mode = BindingMode.TwoWay
         };
         _colRegion.ItemsSource = Region.AllRegions;
         e.Column = _colRegion;
     }
 }
        private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
        {
            Common.HandleColumnAutoGeneration(e);

            //Set built-in aggregate functions
            if (e.Property.Name == "StandardCost")
            {
                DataGridAggregate.SetAggregateFunctions(e.Column,
                                                        new DataGridAggregatesCollection
                {
                    new DataGridAggregateSum {
                        ResultFormat = "SUM = {0}"
                    },
                    new DataGridAggregateAvg {
                        ResultFormat = "AVG = {0}"
                    },
                });
            }

            //Set custom aggregate functions
            if (e.Property.Name == "ProductModelID")
            {
                DataGridAggregate.SetAggregateFunctions(e.Column,
                                                        new DataGridAggregatesCollection
                {
                    new ModelsAggregate {
                        CountItemsWhoseModelIsSpecified = false, ResultFormat = "Not specified = {0}"
                    },
                    new ModelsAggregate {
                        CountItemsWhoseModelIsSpecified = true, ResultFormat = "Specified = {0}"
                    },
                });
            }
        }
 private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     Common.HandleColumnAutoGeneration(e);
     if (e.Property.Name == "ImageUrl")
     {
         e.Cancel = true;
     }
 }
示例#4
0
 private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     // invoke common autogeneration handling for all the samples
     Common.HandleColumnAutoGeneration(e);
     if (e.Property.Name == "ImageUrl")
     {
         e.Cancel = true;
     }
 }
示例#5
0
 private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     Common.HandleColumnAutoGeneration(e);
     if (e.Property.Name == "Name" && e.Column is C1.WPF.DataGrid.DataGridBoundColumn)
     {
         e.Column.Width = new C1.WPF.DataGrid.DataGridLength(200);
         ((C1.WPF.DataGrid.DataGridBoundColumn)e.Column).TextWrapping = TextWrapping.Wrap;
     }
 }
        private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
        {
            Common.HandleColumnAutoGeneration(e);

            // avoid image columns for add/remove samples
            if (e.Column is DataGridImageColumn)
            {
                e.Cancel = true;
            }
        }
        private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
        {
            Common.HandleColumnAutoGeneration(e);

            if (e.Property.Name == "StandardCost")
            {
                DataGridAggregate.SetAggregateFunctions(e.Column, new DataGridAggregatesCollection {
                    new DataGridAggregateSum()
                });
            }
        }
 private void C1DataGrid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.Property.Name == "Occupation")
     {
         var comboCol = e.Column as C1.WPF.DataGrid.DataGridComboBoxColumn;
         if (comboCol != null && comboCol.Binding != null)
         {
             comboCol.Binding.Converter = new EnumConverter(e.Property.PropertyType);
         }
     }
 }
 private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.Property.Name == "WBS")
     {
         e.Column.Width = C1.WPF.DataGrid.DataGridLength.Auto;
     }
     if (e.Column is DataGridDateTimeColumn)
     {
         ((DataGridDateTimeColumn)e.Column).Format = "ddd d/M/yyyy";
     }
     if (e.Property.Name == "Duration" && e.Column is C1.WPF.DataGrid.DataGridBoundColumn)
     {
         ((C1.WPF.DataGrid.DataGridBoundColumn)e.Column).Binding.Converter = CustomConverter.Create((value, type, parameter, culture) =>
         {
             var valueTS = (TimeSpan)value;
             return(string.Format("{0:N1} days?", valueTS.TotalDays));
         });
     }
     if (new string[] { "Level", "ParentTask", "SubTasks", "IsExpanded", "IsVisible" }.Contains(e.Property.Name))
     {
         e.Cancel = true;
     }
 }
示例#10
0
 private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     Common.HandleColumnAutoGeneration(e);
 }
示例#11
0
 private void grid_AutoGeneratingColumn(object sender, C1.WPF.DataGrid.DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.Property.Name == "Description")
     {
         e.Cancel = true;
     }
     if (e.Property.Name == "ID")
     {
         e.Cancel = true;
     }
     if (e.Property.Name == "Name")
     {
         e.Column                   = new DataGridMultiLineTextColumn(e.Property);
         e.Column.Header            = "Multi-line column";
         e.Column.VerticalAlignment = VerticalAlignment.Top;
     }
     if (e.Property.Name == "ImageUrl")
     {
         e.Cancel = true;
     }
     if (e.Property.Name == "ProductSubcategoryID")
     {
         e.Cancel = true;
     }
     if (e.Property.Name == "Available")
     {
         e.Cancel = true;
     }
     if (e.Property.Name == "ExpirationDate")
     {
         e.Cancel = true;
         //e.Column.Format = "MM/dd/yy HH:mm:ss";
         //(e.Column as DataGridDateTimeColumn).DateFormat =
         //(e.Column as DataGridDateTimeColumn).TimeFormat = C1TimeEditorFormat.ShortTime;
     }
     if (e.Property.Name == "StandardCost")
     {
         e.Column = new DataGridCustomNumericColumn(e.Property);
         TextBlock _txtBlock = new TextBlock()
         {
             Text = "Std. Cost (tooltip)",
             HorizontalAlignment = HorizontalAlignment.Right,
             VerticalAlignment   = VerticalAlignment.Center
         };
         ToolTipService.SetToolTip(_txtBlock, new ToolTip()
         {
             Content = "It's a custom tooltip."
         });
         e.Column.Header = _txtBlock;
     }
     if (e.Property.Name == "ProductNumber")
     {
         var column = new DataGridMaskedTextColumn(e.Property);
         column.Mask           = "aa-aaaa-aa";
         column.TextMaskFormat = MaskFormat.IncludeLiterals;
         e.Column = column;
     }
     if (e.Property.Name == "ProductModelID")
     {
         var comboCol = new C1.WPF.DataGrid.DataGridComboBoxColumn(e.Property);
         comboCol.DisplayMemberPath = "Name";
         comboCol.SelectedValuePath = "ProductModelID";
         comboCol.ItemsSource       = Data.GetModels();
         e.Column = comboCol;
     }
     if (e.Property.Name == "Color")
     {
         e.Column = new DataGridColorColumn(e.Property);
     }
 }