当前位置: 首页>>代码示例>>C#>>正文


C# Controls.DataGridAutoGeneratingColumnEventArgs类代码示例

本文整理汇总了C#中System.Windows.Controls.DataGridAutoGeneratingColumnEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DataGridAutoGeneratingColumnEventArgs类的具体用法?C# DataGridAutoGeneratingColumnEventArgs怎么用?C# DataGridAutoGeneratingColumnEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataGridAutoGeneratingColumnEventArgs类属于System.Windows.Controls命名空间,在下文中一共展示了DataGridAutoGeneratingColumnEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataGrid_OnAutoGeneratingColumn

        private void DataGrid_OnAutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "Bitrate":
                    e.Column.Header = Properties.Resources.columnBitrate;
                    e.Column.IsReadOnly = true;
                    e.Column.CanUserSort = true;
                    
                    break;
                case "ContentType":
                    e.Column.Header = "MIME(ContentType)";
                    e.Column.IsReadOnly = true;
                    break;

                case "Url":
                    var style = new Style(typeof (TextBlock));
                    style.Setters.Add(new EventSetter(Hyperlink.ClickEvent,(RoutedEventHandler)Hyperlink_Clickhandler));
                    var c = new DataGridHyperlinkColumn()
                    {
                        Header = Properties.Resources.columnUrl,
                        ElementStyle = style,
                        Binding = new Binding("Url"),
                        CanUserSort = true,
                        IsReadOnly = true
                    };
                    e.Column = c;
                    
                    
                    break;
            }
        }
开发者ID:hinaloe,项目名称:TwitterVideoUploader,代码行数:32,代码来源:EntitiesInfoWindow.xaml.cs

示例2: SpaceOutNames

 public static void SpaceOutNames(DataGridAutoGeneratingColumnEventArgs e)
 {
     switch (e.PropertyName)
     {
         case "SongTitle":
             e.Column.Header = "Song Title";
             break;
         case "SongRating":
             e.Column.Header = "Song Rating";
             break;
         case "TrackLengthSeconds":
             e.Column.Header = "Track Length in Seconds";
             break;
         case "AlbumRating":
             e.Column.Header = "Album Rating";
             break;
         case "AlbumYear":
             e.Column.Header = "Album Year";
             break;
         case "TrackNumber":
             e.Column.Header = "Track Number";
             break;
         case "AlbumTitle":
             e.Column.Header = "Album";
             break;
         case "GenreName":
             e.Column.Header = "Genre";
             break;
     }
 }
开发者ID:Kindlar,项目名称:CapstoneCDCatalog,代码行数:30,代码来源:CellFormating.cs

示例3: OnAutoGeneratingColumn

        protected override void OnAutoGeneratingColumn(DataGridAutoGeneratingColumnEventArgs e)
        {
            PropertyDescriptor desc = e.PropertyDescriptor as PropertyDescriptor;

            if (desc.IsEmpty())
            {
                return;
            }

            Attribute hide = desc.Attributes[typeof(ColumnHideAttribute)];
            if (hide != null)
            {
                e.Cancel = true;
                return;
            }

            DataGridTemplateColumnEx templateColumn = new DataGridTemplateColumnEx();
            templateColumn.CellTemplate = CreateDataTemplate(e);
            templateColumn.CellEditingTemplate = CreateEditDataTemplate(e);
            //templateColumn.SortMemberPath = "DueDate";

            e.Column = templateColumn;

            ColumnStyleAttribute header = desc.Attributes[typeof(ColumnStyleAttribute)] as ColumnStyleAttribute;
            if (!header.IsEmpty())
            {
                e.Column.Header = header.Header;
                e.Column.IsReadOnly = header.ReadOnly;
            }

            base.OnAutoGeneratingColumn(e);
        }
开发者ID:higeneko2015,项目名称:WCFCommon,代码行数:32,代码来源:DataGridEx.cs

示例4: OnAutoGeneratingColumn

 private void OnAutoGeneratingColumn(object send, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.PropertyType == typeof(DateTime))
     {
         (e.Column as System.Windows.Controls.DataGridTextColumn).Binding.StringFormat = "MM-dd-yyyy";
     }
 }
开发者ID:Toffer305,项目名称:icresponse2,代码行数:7,代码来源:TodaysCalls.xaml.cs

示例5: DataGridConfig_AutoGeneratingColumn

        static void DataGridConfig_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            if (e.PropertyDescriptor != null )
            {

                PropertyInfo propDisplayName = e.PropertyDescriptor.GetType().GetProperty("DisplayName");
                PropertyInfo propComponentType = e.PropertyDescriptor.GetType().GetProperty("ComponentType");
                Type componentType = propComponentType.GetValue(e.PropertyDescriptor) as Type;
                PropertyInfo propertyInfo = componentType.GetProperty(e.PropertyName);
                if (propertyInfo.GetGetMethod().IsVirtual)
                {
                    e.Cancel = true;
                }
                else
                {
                    if (propDisplayName != null)
                    {
                        Object objDisplayName = propDisplayName.GetValue(e.PropertyDescriptor);
                        if (objDisplayName != null)
                        { e.Column.Header = objDisplayName.ToString(); }
                    }
                }

            }
        }
开发者ID:ChampsyGnom,项目名称:GeoPatV2,代码行数:25,代码来源:DataGridConfig.cs

示例6: ApplyAutogeneratedColumnAttributes

    public static void ApplyAutogeneratedColumnAttributes(DataGridAutoGeneratingColumnEventArgs e)
    {
      PropertyDescriptor pd = e.PropertyDescriptor as PropertyDescriptor;
      if (pd.Attributes[typeof(HiddenColumn)] != null)
      {
        e.Cancel = true;
        return;
      }

      DisplayNameAttribute nameAttribute = pd.Attributes[typeof(DisplayNameAttribute)] as DisplayNameAttribute;
      if (nameAttribute != null && !String.IsNullOrEmpty(nameAttribute.DisplayName))
      {
        e.Column.Header = nameAttribute.DisplayName;
      }

      ColumnWidth columnWidth = pd.Attributes[typeof(ColumnWidth)] as ColumnWidth;
      if (columnWidth != null)
      {
        e.Column.Width = columnWidth.Width;
      }

      if (e.PropertyType == typeof(double))
      {
        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:0.###}";
      }

			if (e.PropertyType == typeof(bool) && !e.Column.IsReadOnly)
			{
				var checkboxFactory = new FrameworkElementFactory(typeof(CheckBox));
				checkboxFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center);
				checkboxFactory.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);
				checkboxFactory.SetBinding(CheckBox.IsCheckedProperty, new Binding(e.PropertyName) { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged });
				e.Column = new DataGridTemplateColumn { Header = e.Column.Header, CellTemplate = new DataTemplate { VisualTree = checkboxFactory }, SortMemberPath = e.Column.SortMemberPath };
			}
    }
开发者ID:corefan,项目名称:brofiler,代码行数:35,代码来源:FrameDataTable.xaml.cs

示例7: dataGrid_AutoGeneratingColumn

 private void dataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     // プロパティ名をもとに自動生成する列をカスタマイズします
     switch (e.PropertyName)
     {
         case "Name":
             // Name列は最初に表示してヘッダーを名前にする
             e.Column.Header = "名前";
             e.Column.DisplayIndex = 0;
             break;
         case "Age":
             // Ageプロパティは1番目に表示してヘッダーを年齢にする
             e.Column.Header = "年齢";
             e.Column.DisplayIndex = 1;
             break;
         case "Gender":
             // Genderプロパティは表示しない
             e.Cancel = true;
             break;
         case "AuthMember":
             // AuthMemberプロパティは2番目に表示してヘッダーを承認済みにする
             e.Column.Header = "承認済み";
             e.Column.DisplayIndex = 2;
             break;
         default:
             throw new InvalidOperationException();
     }
 }
开发者ID:runceel,项目名称:samples,代码行数:28,代码来源:MainWindow.xaml.cs

示例8: grdData_AutoGeneratingColumn

 //this will make sure that the "ExtentionData" column added as part of Serialization is prevented from showing up on the grid.
 void grdData_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.Column.Header.ToString() == "ExtensionData")
     {
         e.Cancel = true;
     }
 }
开发者ID:kimboox44,项目名称:SchoolLibrary,代码行数:8,代码来源:MainWindow.xaml.cs

示例9: dataGrid_AutoGeneratingColumn

 private void dataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.PropertyName == "IDProdotto")
     {
         e.Cancel = true;
     }
 }
开发者ID:zetanove,项目名称:Esempi_Silverlight4,代码行数:7,代码来源:Home.xaml.cs

示例10: OnAutoGeneratingColumn

 void OnAutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.PropertyName == "Avatar")
     {
         e.Cancel = true;
     }
 }
开发者ID:kgrittner,项目名称:WPF_Tutorial,代码行数:7,代码来源:DataGridDemo.xaml.cs

示例11: m_dataGridChamleon_AutoGeneratingColumn

 void m_dataGridChamleon_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (column_num > (column_names.Length - 1)) { column_num = 0; }
     e.Column.Header = column_names[column_num];
     e.Column.Width = new DataGridLength(Convert.ToDouble(column_names[column_num + 1]), DataGridLengthUnitType.Pixel);
     column_num += 2;
 }
开发者ID:jharriman,项目名称:CoolSignDb-Server-Client,代码行数:7,代码来源:NameapceDialog2.xaml.cs

示例12: dgReport_AutoGeneratingColumn

		private void dgReport_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) {
			var pd = e.PropertyDescriptor as PropertyDescriptor;
			var displayAttrib = pd.Attributes[typeof(DisplayAttribute)] as DisplayAttribute;

			if (displayAttrib != null) {
				e.Column.Header = ResReports.ResourceManager.GetString(displayAttrib.Name);
			}
		}
开发者ID:abdojobs,项目名称:gestadh45,代码行数:8,代码来源:ReportingUC.xaml.cs

示例13: DataGridPopularItems_OnAutoGeneratingColumn

        /// <summary>
        /// Handles the OnAutoGeneratingColumn event of the DataGridPopularItems control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataGridAutoGeneratingColumnEventArgs"/> instance containing the event data.</param>
        private void DataGridPopularItems_OnAutoGeneratingColumn(object sender,
                                                                         DataGridAutoGeneratingColumnEventArgs e)
        {
            if ( e.PropertyName == "id" ) e.Cancel = true;

                        e.Column.MinWidth = e.Column.ActualWidth;
                        e.Column.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
        }
开发者ID:digideskio,项目名称:MediaTracker,代码行数:13,代码来源:PopularItems.xaml.cs

示例14: dataGrid_AutoGeneratingColumn

 private void dataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.Column.Header.ToString() == "Id") { e.Column.Header = "Azonosító"; e.Column.IsReadOnly = true; }
     if (e.Column.Header.ToString() == "Name") { e.Column.Header = "Megnevezés"; e.Column.Width = 150; }
     if (e.Column.Header.ToString() == "Quantity") { e.Column.Header = "Mennyiség"; }
     if (e.Column.Header.ToString() == "Unit") { e.Column.Header = "Egység"; }
     if (e.Column.Header.ToString() == "Status") e.Column.Visibility = Visibility.Hidden;
 }
开发者ID:hubasky,项目名称:oe-nik-softtech2-private-hospital,代码行数:8,代码来源:InventoryControl.xaml.cs

示例15: DataTable_OnAutoGeneratingColumn

 private void DataTable_OnAutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     string displayName = GetPropertyDisplayName(e.PropertyDescriptor);
     if (!string.IsNullOrEmpty(displayName))
     {
         e.Column.Header = displayName;
     }
 }
开发者ID:almarkua,项目名称:WASP-F-E,代码行数:8,代码来源:CompareStudies.xaml.cs


注:本文中的System.Windows.Controls.DataGridAutoGeneratingColumnEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。