使用教程列表 |
问题描述: DevExpress.XtraReports.v11.2这个版本中,PrintingSystem属性是只读的,没有办法给它赋值了,DevExpress.XtraReports.v7.2版本里面这个属性是可以赋值的,请问这个应该怎样解决呢? 问题解答: 最新版的XtraReport控件的PrintingSystem属性是只读的,这个并不是控件的Bug。目前要实现类似的功能,可使用以下代码实现: PrintingSystem CreateReport(GridControl gridControl) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); //{ Component = gridControl }; link.Component = gridControl; link.CreateDocument(); return link.PrintingSystem; } private void button1_Click(object sender, EventArgs e) { PrintingSystem ps = CreateReport(gridControl1); ps.PrintDlg(); } 技术:.NET 产品:XtraReports(包含在DevExpress Universal套包中) 关键字: Report 赋值 XtraReports 报表 PrintingSystem |
问题描述: DevExpress v11.2中的GridControl 每次运行程序的时候此控件都会自动选中第一行,是否可以实现运行时不选中任何行? 问题解答: 如果你的数据源不为空的话,XtraGrid总会有一个聚焦行。FocusedRowHandle是与CurrencyManager.Position 同步的,并且是不能取消的。但你可以通过隐藏聚焦行的高亮来实现该功能:
关键字: GridControl XtraGrid 聚焦行 |
尽管当前的DevExpress AgDataGrid 不具有内置的主从数据支持,但是你可以通过grid 控件的PreviewTemplate来显示数据的详细信息。将AgDataGrid控件添加到master grid的PreviewTemplate,然后将其绑定到detail collection。 接下来我们一起来看一个简单的例子: [C#] public class Product { public int ProductID { get; set; } public string ProductName { get; set; } public int CategoryID { get; set; } public decimal UnitPrice { get; set; } } public class Category { public int CategoryID { get; set; } public string CategoryName { get; set; } public string Description { get; set; } public List<Products> Products { get; set; } 以分层方式来显示数据,需根据以下步骤: 1)在页面中添加AgDataGrid 控件 [XAML] <Grid x:Name="LayoutRoot"> <grid:AgDataGrid x:Name="masterGrid" ColumnsAutoWidth="True"> <grid:AgDataGrid.Columns> <grid:AgDataGridColumn FieldName="CategoryID"/> <grid:AgDataGridColumn FieldName="CategoryName"/> <grid:AgDataGridColumn FieldName="Description"/> </grid:AgDataGrid.Columns> </grid:AgDataGrid> </Grid> 接下来将AgDataGrid控件绑定到分类中: [C#] public MainPage() { InitializeComponent(); masterGrid.DataSource = CategoriesData.DataSource; } 这就是master grid。 2)定义master grid的PreviewTemplate,并新增AgDataGrid控件: [XAML] <grid:AgDataGrid.PreviewTemplate> <DataTemplate> <Grid Height="180" Margin="20, 10, 20, 10"> <controls:TabControl> <controls:TabItem Header="Products"> <grid:AgDataGrid x:Name="detailGrid"> </grid:AgDataGrid> </controls:TabItem> </controls:TabControl> </Grid> </DataTemplate> </grid:AgDataGrid.PreviewTemplate> 3)将AgDataGrid绑定到产品属性: [XAML] <grid:AgDataGrid.PreviewTemplate> <DataTemplate> <Grid Height="180" Margin="20, 10, 20, 10"> <controls:TabControl> <controls:TabItem Header="Products"> <grid:AgDataGrid x:Name="detailGrid" DataSource="{Binding Products}" ColumnsAutoWidth="True"> <grid:AgDataGrid.Columns> <grid:AgDataGridColumn FieldName="ProductID" /> <grid:AgDataGridColumn FieldName="ProductName" /> <grid:AgDataGridColumn FieldName="CategoryID" /> <grid:AgDataGridColumn FieldName="UnitPrice" /> </grid:AgDataGrid.Columns> </grid:AgDataGrid> </controls:TabItem> </controls:TabControl> </Grid> </DataTemplate> </grid:AgDataGrid.PreviewTemplate> 4)设置master grid的PreviewVisibility属性值为ExpandedForFocusedRow, [XAML] <grid:AgDataGrid x:Name="masterGrid" ColumnsAutoWidth="True" PreviewVisibility="ExpandedForFocusedRow"> 运行代码后的结果如下:
关键字: DevExpress |
问题描述: XtraGrid.GridControl在GridView绑定列中,某列column使用了: column.DisplayFormat.FormatType = FormatType.Custom; column.DisplayFormat.Format = provider; 将列内容进行格式化显示,grid显示是格式化后的数据,但使用导出功能gridView.ExportToXlsx,导出来的文件中显示的却是未格式化的原始内容。 请问,怎么才能让导出来的数据和表格显示的一致,是格式化后的数据呢? 问题解答: 您需要将XlsxExportOptions.TextExportMode设置为Text,具体请参考以下代码: XlsxExportOptions option = new XlsxExportOptions(); option.TextExportMode = TextExportMode.Text; gridView1.ExportToXlsx("grid.xlsx", option); 关键字: XtraGrid GridControl GridView 格式化 数据 |
问题描述: NavBar控件怎么实现,如下图中圈红的部分,就是在二级菜单下再实现折叠? 问题解答: 您可以将NavBar的GroupStlye设置为ControlContainer。然后您就可以在NavBar里面添加控件了,比如NavBar或者Treelist,就可以实现您需要的2级折叠效果! 技术:.NET 产品:NavBar(包含在DevExpress Universal套包中) |
在DevExpress 12.1中,你不再需要通过使用ASPxThemeDeployer工具来将皮肤文件提取到项目的App_Themes主题文件夹。所有所需的资源都可以从DevExpress.Web.ASPxThemes.v12.1中自动套用。如果你只使用DevExpress.Web.ASPxThemes.v12.1库中的主题,你可以以下列方式更新您的ASP.NET应用程序项目: 1、删除App_Themes文件夹 2、修改Web.config文件: [XML] <configSections><sectionGroup name="devExpress"> <!-- Add this line --> <section name="themes" type="DevExpress.Web.ASPxClasses.ThemesConfigurationSection, DevExpress.Web.v12.1, Version=12.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> </sectionGroup> </configSections> <devExpress> <system.web> 执行这些操作后,ThemesAssembly 所指定的主题将被启用。 由于Choose Theme Action即开即用,Choose Theme Action允许你在DevExpress.Web.ASPxThemes.v12.1所提供的所有主题之间自由切换。选定的主题将被保存在用户浏览器的cookies中,因此当用户下一次运行程序时,该主题还可以被用户所使用。 |
问题描述: 我根据示例“DevExpress如何根据相应的列打印分组的汇总值”已经实现了在excel导出中打印自定义值。 但是Grid-Bands不能导出到Excel。我可以激活它们吗? 可以像在Excel中第一行的“file created on...”一样自定义文本吗? 问题解答: Bands必须导出到Excel。我附加了一个项目来说明这一点(请查看附件并下载)。 在Excel中的第一行打印一个自定义的文本,需要使用Printing library。打印你的文本在LinkBase.CreateReportHeaderArea事件中处理程序。附件中的项目很好地说明了这种方法。 技术:.NET 平台:WinForms 产品:XtraGrid Suite(包含在DevExpress WinForms套包中) 版本:v2010 vol 2.3 操作系统:Windows XP 开发工具:Microsoft Visual Studio 2010 |
DevExpress 控件是利用模版来呈现控件外观的。 要呈现一个绝佳的外观,我们需要使用带有嵌套边框和渐变画笔的复杂模版。这样一来,不能通过简单的风格设置来改变控件的颜色,因为控件的颜色改变取决于不同画笔产生的视觉效果。本文主要想客户展示如何修改主题的模版。 要修改控件的外观,你需要找到必要元素的模版,将模版嵌入到您的应用程序资源中,准确的修改模版并且不可破坏模版的内部结构。一旦你修改了模版的结构,你便会破坏一些功能。 另外,还值得一提的是,相同的模版会因为主题的不同而不同。要实现一个特定主题的自定义模版(不是默认深蓝主题),需要在模版KEY中指定ThemeName属性。下面以我们的默认深蓝主题的RowIndicator的模版为例: [XAML] xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"... <Window.Resources> <DataTemplate x:Key="{dxgt:RowIndicatorThemeKey ResourceKey=IconPresenterTemplate}"> .... </DataTemplate> </Window.Resources> 如果您分配Office2007Black主题,该模板将不适用。创建一个Office2007Black模板,分配的ThemeName的属性: [XAML] xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"... <Window.Resources> <DataTemplate x:Key="{dxgt:RowIndicatorThemeKey ResourceKey=IconPresenterTemplate,ThemeName=Office2007Black}"> .. </DataTemplate> </Window.Resources> 如果你不需要为不同的主题创建模版,您的自定义模板是一个独立的主题,只需设置IsThemeIndependent属性为True: [XAML] xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"... <Window.Resources> <DataTemplate x:Key="{dxgt:RowIndicatorThemeKey ResourceKey=IconPresenterTemplate, IsThemeIndependent=true}"> .. </DataTemplate> </Window.Resources> 到现在,最有趣的问题就是如何找到所需模版。在DevExpress WPF中有两种方法可以找到所需模版:使用snoop工具和使用ThemeEditor。 Snoop工具:这个工具允许你搜索控件的可视化树。 在控件库文件夹中搜索需要的名称,以GridControl为例: "c:\Program Files (x86)\DXperience 12.1\Sources\DevExpress.Xpf.Grid" 如果你不使用默认名称,你需要在相应的主题文件夹中寻找: "c:\Program Files (x86)\DXperience 12.1\Sources\DevExpress.Xpf.Themes" 最后一步就是,从源代码中复制模版,将模版嵌入到容器资源中如Window.Resources。请记住,你需要使用默认深蓝主题,利用修改后的模版。 Theme Editor:它是一个独立的编辑器工具,可让你修改内置的DevExpress主题和创建基于内置主题的新主题。该新工具的主要目的是简化挨罚人员编辑第三方主题的繁琐工作,只用一个标记来定位特定的视觉元素和外观设置。 关键字: DXperience DevExpress |
问题描述: 我通过如下代码将销售订单数据填入到GridView中。 strSQL = "select SalesOrderNo, Type , CustomerPoNo, DeliveryDate, PaymentTerm, CourierID " & _"from SalesOrder where CustomerID = '" & strCustomerID.Trim.ToUpper & "' " ConnString = GetConnectionString() conn = New SqlConnection(ConnString) conn.Open() da.SelectCommand = New SqlCommand(strSQL, conn) da.Fill(dt) If dt IsNot Nothing Then If dt.Rows.Count > 0 Then GridControl1.DataSource = dt dt.Dispose() End If End If 但是我想将Gridview标头字段的名称(如SalesOrderNo,Type,CustomerPoNo ...)改为繁体或者简体中文字段名称,如下图所示。 请问可以实现吗? 问题解答: 你可以遍历在GridView.Columns集合中的所有列,并指定其Caption属性。 例如: [VB.NET] For Each column As gridColumn In GridView1.Columns column.Caption = column.FieldName Next 如果你在表的构造函数中为网格配置了一个数据源,在自定义列前必须先完成网格初始化。 对于这一点,调用GridControl.ForceInitialize或GridView.PopulateColumns方法,从视图绑定数据源的所有字段手动创建列。 技术:.NET 平台:WinForms 产品:XtraGrid Suite(包含在DevExpress WinForms套包中) 版本:v2011 vol 1.11 操作系统:Windows 7 开发工具:Microsoft Visual Studio 2010 |
本文主要介绍如果通过创建自定义DevExpress XtraVerticalGrid控件子节点来实现自定义行缩进。 注:从DevExpress 12.1版本开始,你可以通过VGridControlBase.OptionsView.LevelIndent属性来实现实现自定义行缩进。 C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication41 private void Form1_Load(object sender, EventArgs e) Imports Microsoft.VisualBasic Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Namespace WindowsApplication41 Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load 关键字: DevExpress XtraGrid |
本文主要介绍两种方法来解决标签过长时导致的重叠问题。第一种方法是通过标签的Angle属性将标签旋转。此外,我们建立您启用Antialiasing属性,有助于流畅地绘制标签文本。第二种方法是使用轴标签的Staggered属性。 注:从DXperience12.1开始,已经解决XtraCharts轴标签的重叠问题。 C#
using System; namespace AxisLabelsResolveOverlapping { private void Form1_Load(object sender, EventArgs e) { // Create a series and add points to it. series1.Points.Add(new SeriesPoint("First Argument", 10.5678)); // Add the series to the chart. // Hide the legend (optional). // Make the X-axis labels staggered. // Add a prefix to the Y-axis labels, and rotate them. } Imports Microsoft.VisualBasic Namespace AxisLabelsResolveOverlapping Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load ' Create a series and add points to it. series1.Points.Add(New SeriesPoint("First Argument", 10.5678)) ' Add the series to the chart. ' Hide the legend (optional). ' Cast the chart's diagram to the XYDiagram type, ' Make the X-axis labels staggered. ' Add a prefix to the Y-axis labels, and rotate them. ' Add the chart to the form. End Class 关键字: DevExpress XtraCharts |
问题描述: 我们在使用DevExpress XtraGrid时遇到一个问题,XtraGrid结果中的中文字符只可以在部分电脑中正确显示和正确地导出到Excel中,但是在另外一部分电脑上却不行。 问题解答: 我的猜测是中国汉字显示不正确的机器没有安装相应的服务。尤其是这些机器如果是安装的Window XP系统,请你检查这些机器是否有汉字支持。 |
很抱歉,我们的网格在计算行数时将组群也考虑了进去,我们不能改变这个算法。你可能已经注意到,过去我们多次讨论了这种特性: http://search.devexpress.com/?q=group+row+count&p=T4|P5|57&d=159Grid pager includes grouping rows in its item count Total Row Count in Footer is Counting the Grouped Rows 如果你想排除组行的数目,你需要遍历所有的行,并使用客户端ASPxClientGridView.IsGroupRow方法查看组行。 |
问题描述: 我有一个第一列为日期列的GridView。它在运行时会绑定到日期,但他们通过CustomColumnDisplayText事件定制类似下面的季度和全年格式转换的日期: [C#] 然而,当我将GridView导出为xls或xlsx格式时,返回绑定到网格的日期列丢失了格式,显示的是实际日期。我怎样才能在将网格导出为xls或xlsx时自定义日期并保持它?当我将网格导出为PDF或HTML格式时日期似乎并没有发生变化。 问题解答: 改变CustomColumnDisplayText只能影响显示的文字,并不会改变数据源的值。 默认情况下,GridControl导出的是数据字段值,而不是显示的文字。为了解决这个问题,您可以将导出数据作为一个字符串,通过将TextExportMode对象的XlsExportOptions属性设置为文本即可实现。 [C#] |
慧都控件网为DevExpress界面控件的中国地区唯一正式授权经销商,正版控件销售公司,授权代理商,经销商及合作伙伴。
电话:400-700-1020
023-66090381
邮箱:sales@evget.com