2012-12-27 84 views
3

我使用Codeplex上verison Xceed DataGrid的默認文本。
但同時顯示在表格網格中,「技術Xceed」文本數據網格的右上角即將到來。
enter image description here去除Xceed DataGrid中

是否可以刪除它?怎麼樣?

+1

如果您使用的社區版,這是不合法的,它違背了許可協議(無水印=加版。) – punker76

回答

7

我嘗試這樣做。有效。

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

我在這前些天寫了一個簡短的博客文章。我做了一個簡單的擴展方法來找到裝飾層並將其刪除。

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

1

我認爲simples地清除GroupByControl是修改FixedHeaders屬性:以「摺疊」比如上例中的財產Visibility

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

只需設置值。

相關問題