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


C# Controls.GridViewColumn类代码示例

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


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

示例1: Fenetre_Classement

        public Fenetre_Classement()
        {
            InitializeComponent();

            CT_Get_Classement CT = new CT_Get_Classement();
            
            Joueur[] classement = (Joueur[])CT.Exec(new Message()).Data[0];

            GridView view = new GridView();

            GridViewColumn col1 = new GridViewColumn();
            col1.Header = "Nom";
            col1.DisplayMemberBinding = new Binding("Nom");
            view.Columns.Add(col1);

            GridViewColumn col2 = new GridViewColumn();
            col2.Header = "Score";
            col2.DisplayMemberBinding = new Binding("Score");
            view.Columns.Add(col2);

            view.AllowsColumnReorder = false;
            this.ClassementListView.View = view;

            foreach (Joueur j in classement)
            {
                this.ClassementListView.Items.Add(new Item(j.Nom, j.Score));
            }
        }
开发者ID:WaysGRP2,项目名称:Project.NET,代码行数:28,代码来源:Fenetre_Classement.xaml.cs

示例2: initGridMusic

 private void initGridMusic()
 {
     gridMusic.AllowsColumnReorder = true;
     gridMusic.ColumnHeaderToolTip = "Music information";
     GridViewColumn AlbumColumn = new GridViewColumn();
     AlbumColumn.DisplayMemberBinding = new Binding("album");
     AlbumColumn.Header = "Album";
     AlbumColumn.Width = 150;
     gridMusic.Columns.Add(AlbumColumn);
     GridViewColumn TitleColumn = new GridViewColumn();
     TitleColumn.DisplayMemberBinding = new Binding("title");
     TitleColumn.Header = "Title";
     TitleColumn.Width = 150;
     gridMusic.Columns.Add(TitleColumn);
     GridViewColumn GenreColumn = new GridViewColumn();
     GenreColumn.DisplayMemberBinding = new Binding("genre");
     GenreColumn.Header = "Genre";
     GenreColumn.Width = 100;
     gridMusic.Columns.Add(GenreColumn);
     GridViewColumn LengthColumn = new GridViewColumn();
     LengthColumn.DisplayMemberBinding = new Binding("length");
     LengthColumn.Header = "Length";
     LengthColumn.Width = 57;
     gridMusic.Columns.Add(LengthColumn);
     GridViewColumn ArtistColumn = new GridViewColumn();
     ArtistColumn.DisplayMemberBinding = new Binding("artist");
     ArtistColumn.Header = "Artist";
     ArtistColumn.Width = 150;
     gridMusic.Columns.Add(ArtistColumn);
 }
开发者ID:gitoux,项目名称:Epi-Media-player,代码行数:30,代码来源:GridViewer.cs

示例3: TabularDataViewer

        public TabularDataViewer(IBioLinkReport report, DataMatrix data, IProgressObserver progress)
        {
            InitializeComponent();
            this.Data = data;
            _progress = progress;
            _report = report;
            var view = new GridView();

            var columns = report.DisplayColumns;
            if (columns == null || columns.Count == 0) {
                columns = GenerateDefaultColumns(data);
            }

            var hcs = viewerGrid.Resources["hcs"] as Style;

            foreach (DisplayColumnDefinition c in columns) {
                DisplayColumnDefinition coldef = c;
                var column = new GridViewColumn { Header = BuildColumnHeader(coldef), DisplayMemberBinding = new Binding(String.Format("[{0}]", data.IndexOf(coldef.ColumnName))), HeaderContainerStyle = hcs };
                view.Columns.Add(column);
            }

            lvw.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(GridViewColumnHeaderClickedHandler));

            lvw.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(lvw_MouseRightButtonUp);

            lvw.ItemsSource = Data.Rows;
            this.lvw.View = view;
        }
开发者ID:kehh,项目名称:biolink,代码行数:28,代码来源:TabularDataViewer.xaml.cs

示例4: ViewSource

        public ViewSource(string filePath)
        {
            InitializeComponent();
            if (string.IsNullOrEmpty(filePath))
            { MessageBox.Show("请先选择文件");
              return;
            }
            this.Title = filePath + "的内容";
            FilePath=filePath;
            CSVHelper helper = new CSVHelper(FilePath,'\t');
            DataTable dt = helper.CsVTable;
             listView.DataContext = dt; 
             sourceGridView.Columns.Clear();

             foreach (var colum in dt.Columns)
             {
                 DataColumn dc = (DataColumn)colum;
                 GridViewColumn column = new GridViewColumn();
                 column.DisplayMemberBinding = new Binding(dc.ColumnName);
                 column.Header = dc.ColumnName;
                 sourceGridView.Columns.Add(column);
             }
             Binding bind = new Binding();
             listView.SetBinding(ListView.ItemsSourceProperty, bind);             
        }
开发者ID:peisheng,项目名称:EASYFRAMEWORK,代码行数:25,代码来源:ViewSource.xaml.cs

示例5: RestoreLayout

        public override void RestoreLayout(XmlElement contentElement)
        {
            base.RestoreLayout(contentElement);
           
            if (_errorList == null)
                return;

            GridView gridView = _errorList.View as GridView;

            if (gridView == null)
                return;

            
            GridViewColumn[] cols = new GridViewColumn[gridView.Columns.Count];
            gridView.Columns.CopyTo(cols, 0);
            gridView.Columns.Clear();

            foreach (XmlElement columnElement in contentElement.ChildNodes)
            {
                foreach (GridViewColumn col in cols)
                {
                    if (col.Header.ToString() == columnElement.GetAttribute("Header"))
                    {
                        col.Width = XmlConvert.ToDouble(columnElement.GetAttribute("Width"));
                        gridView.Columns.Add(col);
                        break;
                    }
                }
            }
        }
开发者ID:mousetwentytwo,项目名称:test,代码行数:30,代码来源:ErrorListContent.cs

示例6: GridViewColumnWrapper

        public GridViewColumnWrapper(
			GridViewTable gridViewTable)
        {
            ID = Guid.NewGuid().ToString();
            _gridViewTable = gridViewTable;

            // HACK (ListView)
            var xaml = string.Format(@"
            <DataTemplate
            xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
            xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
            xmlns:Legend=""clr-namespace:TechNewLogic.GraphIT.Hv.Legend;assembly=TechNewLogic.GraphIT"">
            <Legend:TableCellControl
            CellBackground=""{{Binding DynamicRulerValues[{0}].Background}}""
            Text=""{{Binding DynamicRulerValues[{0}].Value}}"" />
            </DataTemplate>",
                ID);

            var stringReader = new StringReader(xaml);
            var xmlReader = XmlReader.Create(stringReader);
            var template = (DataTemplate)XamlReader.Load(xmlReader);

            GridViewColumn = new GridViewColumn
                {
                    CellTemplate = template,
                };
        }
开发者ID:Bruhankovi4,项目名称:Emotyper,代码行数:27,代码来源:GridViewColumnWrapper.xaml.cs

示例7: Convert

 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     var config = value as ColumnConfig;
     if (config != null)
     {
         var gridView = new GridView();
         gridView.ColumnHeaderContainerStyle = Application.Current.FindResource("HeaderContainerStyle") as Style;
         gridView.ColumnHeaderTemplate = Application.Current.FindResource("HeaderTemplate") as DataTemplate;
         if (config.Columns != null)
         {
             foreach (var column in config.Columns)
             {
                 var bindingDisplayMember = new Binding(column.DataField);
                 if (IsStripMultiLinesInList)
                     bindingDisplayMember.Converter = stripMultiLineConverter;
                 GridViewColumn gvc = new GridViewColumn { Header = column, DisplayMemberBinding = bindingDisplayMember };
                 var bindingWidth = new Binding("IsVisible");
                 bindingWidth.Source = column;
                 bindingWidth.Converter = this.columnIsVisibleToWidthConverter;
                 BindingOperations.SetBinding(gvc, GridViewColumn.WidthProperty, bindingWidth);
                 gvc.SetValue(GridViewSort.PropertyNameProperty, bindingDisplayMember.Path.Path);
                 gridView.Columns.Add(gvc);
             }
         }
         return gridView;
     }
     return Binding.DoNothing;
 }
开发者ID:ZoolWay,项目名称:JsonLogViewer,代码行数:28,代码来源:ConfigToDynamicGridViewConverter.cs

示例8: ViewPage

        private void ViewPage(int page, int num)
        {
            DrawingsDataContext dc = DBCommon.NewDC;

            IQueryable<Drawing> res = (from d in dc.Drawings select d).Skip((page - 1)*num).Take(num);

            // Create the GridView
            var gv = new GridView();
            gv.AllowsColumnReorder = true;

            // Create the GridView Columns
            PropertyInfo[] pi = typeof (MPDrawing).GetProperties();


            foreach (PropertyInfo p in pi)
            {
                var gvc = new GridViewColumn();
                gvc.DisplayMemberBinding = new Binding(p.Name);
                gvc.Header = p.Name;
                gvc.Width = Double.NaN;
                gv.Columns.Add(gvc);
            }

            listView1.View = gv;
            listView1.ItemsSource = res;
        }
开发者ID:Raggles,项目名称:MainPower.DrawingsDatabase,代码行数:26,代码来源:RawViewer.xaml.cs

示例9: GenerateMetaColumns

        private void GenerateMetaColumns()
        {
            while (_gridView.Columns.Count > 1)
            {
                _gridView.Columns.RemoveAt(1);
            }

            // dynamically generate columns for meta data 
            var container = theView.DataContext as ContainerVM;
            if (container != null)
            {

                foreach (var info in container.KnownMetaData)
                {
                    GridViewColumn col = new GridViewColumn
                    {
                        Header = info.Name,
                        HeaderContainerStyle = TryFindResource(string.Format("{0}AlignColHeader", info.HeaderAlignment)) as Style,
                        Width = info.Width,
                    };
                    var txt = new FrameworkElementFactory(typeof(TextBlock));
                    txt.SetBinding(TextBlock.TextProperty, new Binding(string.Format("MetaData[{0}].Value", info.Name)) { Converter = info.Formatter, ConverterParameter = info.FormatParameter });
                    txt.SetValue(TextBlock.TextTrimmingProperty, TextTrimming.CharacterEllipsis);
                    txt.SetValue(TextBlock.TextAlignmentProperty, info.ContentAlignment);
                    col.CellTemplate = new DataTemplate() { VisualTree = txt };

                    _gridView.Columns.Add(col);
                }
            }
        }
开发者ID:soukoku,项目名称:MExplorer,代码行数:30,代码来源:ProviderView.xaml.cs

示例10: ChangeIsDeleted

		void ChangeIsDeleted()
		{
			if (_deletationType == LogicalDeletationType.All)
			{
				if (!IsColumnShown)
				{
					var gridViewColumn = new GridViewColumn();
					gridViewColumn.Header = "Дата удаления";
					gridViewColumn.Width = 150;
					var dataTemplate = new DataTemplate();
					var txtElement = new FrameworkElementFactory(typeof(IsDeletedTextBlock));
					dataTemplate.VisualTree = txtElement;
					var binding = new Binding();
					var bindingPath = string.Format("RemovalDate");
					binding.Path = new PropertyPath(bindingPath);
					binding.Mode = BindingMode.OneWay;
					txtElement.SetBinding(IsDeletedTextBlock.TextProperty, binding);
					gridViewColumn.CellTemplate = dataTemplate;
					ListViewLayoutManager.SetCanUserResize(gridViewColumn, false);
					gridView.Columns.Add(gridViewColumn);
				}
			}
			else if (IsColumnShown)
			{
				gridView.Columns.Remove(IsDeletedColumn);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:27,代码来源:ChangeIsDeletedViewSubscriber.cs

示例11: XDataSearchResultHeader

        public XDataSearchResultHeader()
        {
            GridViewColumn column = new GridViewColumn() ;
            column.DisplayMemberBinding = new Binding( "jid" ) ;
            column.Header = Resources.Constant_Jid ;
            Columns.Add( column ) ;

            column = new GridViewColumn() ;
            column.DisplayMemberBinding = new Binding( "first" ) ;
            column.Header = Resources.Constant_FirstName ;
            Columns.Add( column ) ;

            column = new GridViewColumn() ;
            column.DisplayMemberBinding = new Binding( "last" ) ;
            column.Header = Resources.Constant_LastName ;
            Columns.Add( column ) ;

            column = new GridViewColumn() ;
            column.DisplayMemberBinding = new Binding( "nick" ) ;
            column.Header = Resources.Constant_Nickname ;
            Columns.Add( column ) ;

            column = new GridViewColumn() ;
            column.DisplayMemberBinding = new Binding( "email" ) ;
            column.Header = Resources.Constant_Email ;
            Columns.Add( column ) ;
        }
开发者ID:erpframework,项目名称:xeus-messenger2,代码行数:27,代码来源:XDataSearchResultHeader.cs

示例12: SetAlarmList

        public void SetAlarmList()
        {
            GridView gridView = new GridView();
            GridViewColumn column = new GridViewColumn();
            column.Header = "ALARM NO";
            column.Width = double.NaN;
            column.DisplayMemberBinding = new System.Windows.Data.Binding("AlarmNo");
            gridView.Columns.Add(column);

            column = new GridViewColumn();
            column.Header = "NAME";
            column.Width = double.NaN;
            column.DisplayMemberBinding = new System.Windows.Data.Binding("AlarmName");
            gridView.Columns.Add(column);

            //column = new GridViewColumn();
            //column.Header = "DESCRIPTION";
            //column.Width = double.NaN;
            //column.DisplayMemberBinding = new System.Windows.Data.Binding("Description");
            //gridView.Columns.Add(column);

            column = new GridViewColumn();
            column.Header = "SOLUTION";
            column.Width = double.NaN;
            column.DisplayMemberBinding = new System.Windows.Data.Binding("Solution");
            gridView.Columns.Add(column);

            listViewAlarmList.View = gridView;

            listViewAlarmList.FontFamily = new FontFamily("Tahoma");
            listViewAlarmList.FontSize = 16;
            listViewAlarmList.FontWeight = FontWeights.Bold;
        }
开发者ID:vesteksoftware,项目名称:VT5021,代码行数:33,代码来源:PageAlarmDefine.xaml.cs

示例13: UpdateAdditionalColumns

		void UpdateAdditionalColumns()
		{
			GridView gridView = _treeList.View as GridView;
			EmployeesViewModel employeesViewModel = _treeList.DataContext as EmployeesViewModel;
			if (employeesViewModel.AdditionalColumnNames == null)
				return;

			var columnCount = 2;
			for (int i = gridView.Columns.Count - 1; i >= columnCount; i--)
			{
				gridView.Columns.RemoveAt(i);
			}

			for (int i = 0; i < employeesViewModel.AdditionalColumnNames.Count; i++)
			{
				var gridViewColumn = new GridViewColumn();
				gridViewColumn.Header = employeesViewModel.AdditionalColumnNames[i];
				gridViewColumn.Width = 350;

				var dataTemplate = new DataTemplate();
				var txtElement = new FrameworkElementFactory(typeof(TextBlock));
				dataTemplate.VisualTree = txtElement;
				var binding = new Binding();
				var bindingPath = string.Format("AdditionalColumnValues[{0}]", i);
				binding.Path = new PropertyPath(bindingPath);
				binding.Mode = BindingMode.OneWay;
				txtElement.SetBinding(TextBlock.TextProperty, binding);
				ListViewLayoutManager.SetStarWidth(gridViewColumn, 5);
				gridViewColumn.CellTemplate = dataTemplate;
				gridView.Columns.Add(gridViewColumn);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:32,代码来源:EmployeesView.xaml.cs

示例14: ListSystemParameters

        public ListSystemParameters()
        {
            Title = "List System Parameters";

            ListView lstvue = new ListView();
            Content = lstvue;

            GridView grdvue = new GridView();
            lstvue.View = grdvue;

            GridViewColumn col = new GridViewColumn();
            col.Header = "Property Name";
            col.Width = 200;
            col.DisplayMemberBinding = new Binding("Name");
            grdvue.Columns.Add(col);

            col = new GridViewColumn();
            col.Header = "Value";
            col.Width = 200;
            col.DisplayMemberBinding = new Binding("Value");
            grdvue.Columns.Add(col);

            PropertyInfo[] props = typeof(SystemParameters).GetProperties();
            foreach (PropertyInfo prop in props)
            {
                if (prop.PropertyType != typeof(ResourceKey))
                {
                    SystemParam sysparam = new SystemParam();
                    sysparam.Name = prop.Name;
                    sysparam.Value = prop.GetValue(null, null);
                    lstvue.Items.Add(sysparam);
                }
            }
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:34,代码来源:ListSystemParameters.cs

示例15: GetGridView

        private GridView GetGridView(List<dynamic> list)
        {
            GridView gridView = new GridView();

            int i = 0;
            foreach (dynamic item in list)
            {
                GridViewColumn col = new GridViewColumn();
                col.Header = item.Name;
                if (item.Type == "System.Boolean")
                {
                    System.Windows.DataTemplate template = new System.Windows.DataTemplate();
                    System.Windows.FrameworkElementFactory checkBox =
                        new System.Windows.FrameworkElementFactory(typeof(CheckBox));
                    checkBox.SetValue(CheckBox.VerticalAlignmentProperty, System.Windows.VerticalAlignment.Center);
                    Binding bd = new Binding("[" + i.ToString() + "].Value");
                    bd.Mode = BindingMode.OneTime;

                    checkBox.SetBinding(CheckBox.IsCheckedProperty, bd);
                    template.VisualTree = checkBox;
                    col.CellTemplate = template;
                }
                else
                {
                    col.DisplayMemberBinding = new System.Windows.Data.Binding("[" + i.ToString() + "].Value");
                }

                gridView.Columns.Add(col);
                i++;
            }

            return gridView;
        }
开发者ID:vesteksoftware,项目名称:Common_VT5061,代码行数:33,代码来源:PageDebugViewState.xaml.cs


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