Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 删除Xceed datagrid中的默认文本_Wpf_Wpfdatagrid_Xceed Datagrid_Xceed - Fatal编程技术网

Wpf 删除Xceed datagrid中的默认文本

Wpf 删除Xceed datagrid中的默认文本,wpf,wpfdatagrid,xceed-datagrid,xceed,Wpf,Wpfdatagrid,Xceed Datagrid,Xceed,我正在使用Xceed datagrid的Codeplex verison。 但是,在以表格形式显示网格时,“由Xceed供电”文本出现在datagrid的右上角。 是否可以删除此项?怎么做 我试过这个。成功了 <Style TargetType="{x:Type xcdg:HierarchicalGroupByControl}"> <Setter Property="Visibility" Value="Collapsed"/>

我正在使用Xceed datagrid的Codeplex verison。
但是,在以表格形式显示网格时,“由Xceed供电”文本出现在datagrid的右上角。


是否可以删除此项?怎么做

我试过这个。成功了

 <Style TargetType="{x:Type xcdg:HierarchicalGroupByControl}">
            <Setter Property="Visibility" Value="Collapsed"/>
        </Style>  

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

 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;
   }
 }
公共静态类XceedDataGridExtensions
{
公共静态void RemoveWaterMark(此DataGridControl网格)
{
对象hgbc=XceedDataGridExtensions.FindChild(网格,null);
AdornerLayer al=AdornerLayer.GetAdornerLayer(hgbc作为对照);
al.Visibility=System.Windows.Visibility.Collapsed;
}
静态T FindChild(DependencyObject父对象,字符串childName),其中T:DependencyObject
{
//确认父项和子项名称有效。
if(parent==null)返回null;
T foundChild=null;
int childrenCount=visualtreeheloper.GetChildrenCount(父级);
for(int i=0;i
您可以在此处阅读更多信息:


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

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

 <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>


只需将属性的值
可见性设置为“折叠”,如示例所示。

如果您使用社区版,这是不合法的,它违反了许可协议(无水印=Plus ed.)