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


C# GridViewColumn.SetValue方法代码示例

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


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

示例1: 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

示例2: GetOrCreateBehavior

        private static GridViewColumnResizeBehavior GetOrCreateBehavior(GridViewColumn element)
        {
            var behavior = element.GetValue(GridViewColumnResizeBehaviorProperty) as GridViewColumnResizeBehavior;
              if (behavior == null) {
            behavior = new GridViewColumnResizeBehavior(element);
            element.SetValue(GridViewColumnResizeBehaviorProperty, behavior);
              }

              return behavior;
        }
开发者ID:sakya,项目名称:wpfmpdclient,代码行数:10,代码来源:GridViewColumnResize.cs

示例3: UcTableView_SizeChanged

 void UcTableView_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (dt == null)
     {
         return;
     }
     _gridview.Columns.Clear();
     foreach (DataColumn c in dt.Columns)
     {
         GridViewColumn gvc = new GridViewColumn();
         gvc.Header = c.ColumnName;
         if (BShowDetails)
         {
             gvc.Width = (_listview.ActualWidth - 65) / dt.Columns.Count;
         }
         else
         {
             gvc.Width = (_listview.ActualWidth - 25) / dt.Columns.Count;
         }
         gvc.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
         //gvc.DisplayMemberBinding = (new Binding(c.ColumnName));
         FrameworkElementFactory text = new FrameworkElementFactory(typeof(TextBlock));
         text.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Center);
         text.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Center);
         text.SetBinding(TextBlock.TextProperty, new Binding(c.ColumnName));
         DataTemplate dataTemplate = new DataTemplate() { VisualTree = text };
         gvc.CellTemplate = dataTemplate;
         _gridview.Columns.Add(gvc);
     }
     if (BShowDetails)
     {
         GridViewColumn gvc_details = new GridViewColumn();
         gvc_details.Header = "详情";
         FrameworkElementFactory button_details = new FrameworkElementFactory(typeof(Button));
         button_details.SetResourceReference(Button.HorizontalContentAlignmentProperty, HorizontalAlignment.Center);
         button_details.SetValue(Button.WidthProperty, 40.0);
         button_details.AddHandler(Button.ClickEvent, new RoutedEventHandler(details_Click));
         button_details.SetBinding(Button.TagProperty, new Binding(dt.Columns[1].ColumnName));
         button_details.SetValue(Button.ContentProperty, ">>");
         button_details.SetValue(Button.ForegroundProperty, Brushes.Blue);
         button_details.SetValue(Button.FontSizeProperty, 14.0);
         button_details.SetBinding(Button.VisibilityProperty, new Binding(dt.Columns[0].ColumnName) { Converter = new VisibleBtnConverter() });
         DataTemplate dataTemplate_details = new DataTemplate() { VisualTree = button_details };
         gvc_details.CellTemplate = dataTemplate_details;
         _gridview.Columns.Add(gvc_details);
     }
     _listview.ItemsSource = null;
     _listview.ItemsSource = dt.DefaultView;
 }
开发者ID:wuqiangqiang,项目名称:easyfood,代码行数:49,代码来源:UcTableView.xaml.cs

示例4: TaskGridViewColumnSetLabelText

        public static void TaskGridViewColumnSetLabelText(GridViewColumn col, string route, PropertyRoute context)
        {
            DependencyProperty labelText = GridViewColumn.HeaderProperty;

            if (labelText != null && col.NotSet(labelText))
            {
                string text = context.PropertyInfo.NiceName();

                col.SetValue(labelText, text);
            }
        }
开发者ID:rondoo,项目名称:framework,代码行数:11,代码来源:Common.cs

示例5: SetDataTable

        //private List<int> sumColumns = new List<int>();

        public void SetDataTable(DataTable _dt, string title, List<int> columnNumbers)
        {
            this.dt = _dt.Copy();
            this.title = title;
            this.columnNumbers = columnNumbers;
            _title.Text = "▪ " + title;

            _gridview.Columns.Clear();
            foreach (DataColumn c in dt.Columns)
            {
                GridViewColumn gvc = new GridViewColumn();
                gvc.Header = c.ColumnName;
                gvc.Width = (_listview.ActualWidth - 40) / dt.Columns.Count - 44;
                //gvc.DisplayMemberBinding = (new Binding(c.ColumnName));
                FrameworkElementFactory text = new FrameworkElementFactory(typeof(TextBlock));
                text.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Center);
                text.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Center);
                text.SetBinding(TextBlock.TextProperty, new Binding(c.ColumnName));
                DataTemplate dataTemplate = new DataTemplate() { VisualTree = text };
                gvc.CellTemplate = dataTemplate;
                gvc.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
                _gridview.Columns.Add(gvc);
            }
            if (BShowDetails)
            {
                GridViewColumn gvc_details = new GridViewColumn();
                gvc_details.Header = "详情";
                FrameworkElementFactory button_details = new FrameworkElementFactory(typeof(Button));
                button_details.SetResourceReference(Button.HorizontalContentAlignmentProperty, HorizontalAlignment.Center);
                button_details.SetValue(Button.WidthProperty, 40.0);
                button_details.AddHandler(Button.ClickEvent, new RoutedEventHandler(details_Click));
                button_details.SetBinding(Button.TagProperty, new Binding(dt.Columns[1].ColumnName));
                button_details.SetValue(Button.ContentProperty, ">>");
                button_details.SetValue(Button.ForegroundProperty, Brushes.Blue);
                button_details.SetValue(Button.FontSizeProperty, 14.0);
                button_details.SetBinding(Button.VisibilityProperty, new Binding(dt.Columns[0].ColumnName) { Converter = new VisibleBtnConverter() });
                DataTemplate dataTemplate_details = new DataTemplate() { VisualTree = button_details };
                gvc_details.CellTemplate = dataTemplate_details;
                _gridview.Columns.Add(gvc_details);
            }
            _listview.ItemsSource = dt.DefaultView;
        }
开发者ID:wuqiangqiang,项目名称:easyfood,代码行数:44,代码来源:UcTableView.xaml.cs

示例6: SetSortProperty

		public static void SetSortProperty( GridViewColumn owner, String value )
		{
			owner.SetValue( SortPropertyProperty, value );
		}
开发者ID:micdenny,项目名称:Radical.Windows,代码行数:4,代码来源:GridViewColumnManager.cs

示例7: SetFill

		public static void SetFill( GridViewColumn owner, Boolean value )
		{
			owner.SetValue( FillProperty, value );
		}
开发者ID:micdenny,项目名称:Radical.Windows,代码行数:4,代码来源:GridViewColumnManager.cs

示例8: SetSortDirection

 public static void SetSortDirection(GridViewColumn element, ListSortDirection? value)
 {
     element.SetValue(SortDirectionProperty, value);
 }
开发者ID:vincenthamm,项目名称:ATF,代码行数:4,代码来源:GridViewSortBehavior.cs

示例9: SetCanUseSort

 public static void SetCanUseSort(GridViewColumn element, bool value)
 {
     element.SetValue(CanUseSortProperty, value);
 }
开发者ID:vincenthamm,项目名称:ATF,代码行数:4,代码来源:GridViewSortBehavior.cs

示例10: SetSortExpression

 public static void SetSortExpression(GridViewColumn element, string value)
 {
     element.SetValue(SortExpressionProperty, value);
 }
开发者ID:vincenthamm,项目名称:ATF,代码行数:4,代码来源:GridViewSortBehavior.cs

示例11: SetSortPropertyName

 public static void SetSortPropertyName(GridViewColumn obj, string value)
 {
     obj.SetValue(SortPropertyNameProperty, value);
 }
开发者ID:JoshuaWeber,项目名称:HockeyApp-for-Windows,代码行数:4,代码来源:SortableListView.cs

示例12: BonusBoxHunter

        public BonusBoxHunter()
        {
            InitializeComponent();

            ItemIdMap = new Dictionary<String, ItemInformation>();
            HeaderPropertyMap = new Dictionary<String, String>();

            ListViewColumnItem[] Columns = new ListViewColumnItem[]
            {
                new ListViewColumnItem("ID",      "ID",              5,     HorizontalAlignment.Center),
                new ListViewColumnItem("地图",    "Map",             20,    HorizontalAlignment.Center),
                new ListViewColumnItem("物品",    "Item",            20,    HorizontalAlignment.Left),
                new ListViewColumnItem("状态",    "Status",          1,     HorizontalAlignment.Center),
                new ListViewColumnItem("X",       "ActorX",          1,     HorizontalAlignment.Left),
                new ListViewColumnItem("Y",       "ActorY",          1,     HorizontalAlignment.Left),
                new ListViewColumnItem("Z",       "ActorZ",          1,     HorizontalAlignment.Left),
                new ListViewColumnItem("描述",    "Description",     50,    HorizontalAlignment.Center),
            };

            Func<Double, long> GetWidth = (Double percent) =>
                                            {
                                                return (long)Math.Ceiling(percent * Columns.Length / 100);
                                            };

            var lvlmgr = new ListViewLayoutManager(bonusBoxList);

            lvlmgr.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            lvlmgr.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            lvlmgr.AttachScrollViewerScrollChanged = true;

            Style headerStyle = new Style();
            headerStyle.Setters.Add(new Setter(Control.BackgroundProperty, Brushes.White));

            bonusBoxGridView.SetValue(GridView.ColumnHeaderContainerStyleProperty, headerStyle);

            foreach (var col in Columns)
            {
                HeaderPropertyMap[col.Header] = col.Binding;

                GridViewColumn column = new GridViewColumn();

                column.Header = col.Header;
                column.CellTemplate = CreateColumnTemplate(col.Binding, col.Alignment);
                column.SetValue(GridViewColumn.HeaderContainerStyleProperty, headerStyle);

                bonusBoxGridView.Columns.Add(ProportionalColumn.ApplyWidth(column, GetWidth(col.WidthPercent)));
            }

            //String boxinfo = @"E:\Desktop\Source\Hooks\EDAO\Decompiler\GameData\box.json";
            String boxinfo = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\box.json";

            try
            {
                InitializeBonusBoxInfo(boxinfo);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                return;
            }
        }
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:61,代码来源:BonusBoxHunter.xaml.cs

示例13: SetIsSortAtClickEnabled

 /// <summary>
 /// Setzt den Wert der angefügten IsSortAtClickEnabled Abhängigkeitseigenschaft für eine bestimmte <see cref="System.Windows.Controls.GridViewColumn"/>.
 /// </summary>
 /// <param name="gvc">Die <see cref="System.Windows.Controls.GridViewColumn"/> deren Wert gesetzt werdne soll.</param>
 /// <param name="value">Der zu setzende Wert. <c>true</c> wenn das Sortierren der Spalte erlaubt ist; andernfalls <c>false</c></param>
 public static void SetIsSortAtClickEnabled(GridViewColumn gvc, bool value)
 {
     gvc.SetValue(IsSortAtClickEnabledProperty, value);
 }
开发者ID:Koopakiller,项目名称:School,代码行数:9,代码来源:ListViewSort.cs

示例14: SetSortComparer

		public static void SetSortComparer(GridViewColumn element, IItemComparer value)
		{
			element.SetValue(SortComparerProperty, value);
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:4,代码来源:SortBehavior.cs


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