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

有没有可能去掉这个?多么?
发布于 2012-12-27 18:23:04
我试过了。啊,真灵。
<Style TargetType="{x:Type xcdg:HierarchicalGroupByControl}">
<Setter Property="Visibility" Value="Collapsed"/>
</Style> 发布于 2013-03-01 23:06:06
前几天我写了一篇关于这个的简短的博客文章。我做了一个简单的扩展方法来找到装饰层并移除它。
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
发布于 2016-05-15 16:59:56
我认为删除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>只需将属性Visibility的值设置为"Collapsed“即可,如示例所示。
https://stackoverflow.com/questions/14052602
复制相似问题