首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >删除Xceed数据网格中的默认文本

删除Xceed数据网格中的默认文本
EN

Stack Overflow用户
提问于 2012-12-27 17:48:59
回答 3查看 2.6K关注 0票数 3

我使用的是Xceed数据网格的Codeplex版本。

但是在表单中显示网格时,“Powered by Xceed”文本出现在数据网格的右上角。

有没有可能去掉这个?多么?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-12-27 18:23:04

我试过了。啊,真灵。

代码语言:javascript
复制
 <Style TargetType="{x:Type xcdg:HierarchicalGroupByControl}">
            <Setter Property="Visibility" Value="Collapsed"/>
        </Style>  
票数 7
EN

Stack Overflow用户

发布于 2013-03-01 23:06:06

前几天我写了一篇关于这个的简短的博客文章。我做了一个简单的扩展方法来找到装饰层并移除它。

代码语言:javascript
复制
 public static class XceedDataGridExtensions
 {
   public static void RemoveWaterMark(this DataGridControl grid)
   {
     object hgbc = XceedDataGridExtensions.FindChild<HierarchicalGroupByControl>(grid, null);
     AdornerLayer al = AdornerLayer.GetAdornerLayer(hgbc as Control);
     al.Visibility = System.Windows.Visibility.Collapsed;
   }

  static T FindChild<T>(DependencyObject parent, string childName) where T : DependencyObject
  {
     // Confirm parent and childName are valid.
     if (parent == null) return null;
       T foundChild = null;
     int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
     for (int i = 0; i < childrenCount; i++)
     {
       var child = VisualTreeHelper.GetChild(parent, i);
       // If the child is not of the request child type child
       T childType = child as T;
       if (childType == null)
       {
         // recursively drill down the tree
         foundChild = FindChild<T>(child, childName);
         // If the child is found, break so we do not overwrite the found child.
         if (foundChild != null) break;
       }
       else if (!string.IsNullOrEmpty(childName))
       {
         var frameworkElement = child as FrameworkElement;
         // If the child's name is set for search
         if (frameworkElement != null && frameworkElement.Name == childName)
         {
            // if the child's name is of the request name
            foundChild = (T)child;
            break;
         }
      }
      else
      {
         // child element found.
         foundChild = (T)child;
         break;
      }
    }

    return foundChild;
   }
 }

你可以在这里阅读更多信息:http://blog.itsnotfound.com/2013/02/xceed-community-datagridcontrol-watermark-removal/

此外,@punker76在我看来,正如社区网站上的讨论帖子中所述,删除水印并不违反MSPL。开发人员确认了如何通过修改源代码来删除水印。他们甚至正在研究一种更容易接受的解决方案。请参阅此处的讨论:http://wpftoolkit.codeplex.com/discussions/428413

票数 2
EN

Stack Overflow用户

发布于 2016-05-15 16:59:56

我认为删除GroupByControl的简单方法是修改FixedHeaders属性:

代码语言:javascript
复制
 <xcdg:DataGridControl  Grid.ColumnSpan="3"
                           UpdateSourceTrigger="CellContentChanged"
                           Grid.Row="8"
                           AutoCreateColumns="False"
                           IsDeleteCommandEnabled="True"
                           SelectionMode="Single"
                           ItemsSource="{Binding Instructions,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
        <xcdg:DataGridControl.View>
            <xcdg:TableView ShowRowSelectorPane="False"
                            UseDefaultHeadersFooters="False"
                            ColumnStretchMode="All">
                <xcdg:TableView.FixedHeaders>
                    <DataTemplate>
                        <DockPanel>
                            <xcdg:ColumnManagerRow DockPanel.Dock="Right"
                                                   AllowColumnReorder="False"
                                                   AllowColumnResize="False" />
                            <xcdg:GroupByControl x:Name="groupByControl"
                                                 Visibility="Collapsed" />
                        </DockPanel>
                    </DataTemplate>
                </xcdg:TableView.FixedHeaders>
            </xcdg:TableView>
        </xcdg:DataGridControl.View>
        <xcdg:DataGridControl.Columns>
            <xcdg:Column Title="Title"
                         FieldName="Title" />
            <xcdg:Column Title="Content"
                         FieldName="Content" />
            <xcdg:Column Title="Image Url"
                         FieldName="ImageUrl" />
        </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>

只需将属性Visibility的值设置为"Collapsed“即可,如示例所示。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14052602

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档