Xamarin devexpress datagrid 样式
DevExpress的提供光与暗的内置,可以应用到主题GridControl改变其外观。
|
主题 |
iOS版 |
Android版 |
|
光 |
|
|
|
黑暗 |
|
|
应用预定义的主题
该主题类存储提供的主题名称。要更改主题,分配主题类的相应字段的ThemeManager.ThemeName
|
|
||
|
using Xamarin.Forms; using DevExpress.Mobile.DataGrid.Theme; // ... ThemeManager.ThemeName = Themes.Dark; // ... |
自定义主题
要自定义应用的主题,使用ThemeBase类。它为您提供各种定制,使您可以更改主题的外观,并将其应用到电网。您可以使用这些定制来改变背景颜色,字体和所需的网格单元(头,属性组行等)
重要
要应用定制,调用ThemeManager.RefreshTheme方法。
该ThemeBase类的属性提供访问不同的定制,你可以调整来改变外观设置(例如,字体属性,边框和背景颜色等)网格的相应的视觉元素(如数据单元格,行分组,过滤器面板等)。在本实施例中,使用下面的定制。
为了跟踪时刻变化的主题,无论是处理ThemeManager.ThemeChanged事件或使用IThemeChangingHandler.OnThemeChanged方法。
这个例子定制光主题,因为它是在下面的图片中显示。

|
|
||
|
using System; using System.Collections.Generic; using Xamarin.Forms; using DevExpress.Mobile.DataGrid; using DevExpress.Mobile.DataGrid.Theme; namespace ThemeCustomizing { public int count = 0; public MainPage() { InitializeComponent(); TestOrdersRepository model = new TestOrdersRepository(); BindingContext = model; ThemeManager.ThemeName = Themes.Light; // Header customization. ThemeManager.Theme.HeaderCustomizer.BackgroundColor = Color.FromRgb(187, 228, 208); ThemeFontAttributes myFont = new ThemeFontAttributes("Verdana", ThemeFontAttributes.FontSizeFromNamedSize(NamedSize.Large), FontAttributes.None, Color.White); ThemeManager.Theme.HeaderCustomizer.Font = myFont; // Cell customization. ThemeManager.Theme.CellCustomizer.SelectionColor = Color.FromRgb(186, 220, 225); ThemeFontAttributes myFont1 = new ThemeFontAttributes("Verdana", ThemeFontAttributes.FontSizeFromNamedSize(NamedSize.Medium), FontAttributes.None, Color.Black); ThemeManager.Theme.CellCustomizer.Font = myFont1; // Various customization. ThemeManager.Theme.TotalSumaryCustomizer.BackgroundColor = Color.FromRgb(163, 162, 168); ThemeFontAttributes myFont2 = new ThemeFontAttributes("Verdana", ThemeFontAttributes.FontSizeFromNamedSize(NamedSize.Default), FontAttributes.None, Color.Black); ThemeManager.Theme.TotalSummaryCustomizer.Font = myFont2; ThemeManager.Theme.NewItemRowCustomizer.Font = myFont2; ThemeManager.RefreshTheme(); } void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) { if (e.FieldName.ToString() == "Shipped") if (e.IsTotalSummary) { if (e.SummaryProcess == CustomSummaryProcess.Calculate) { if (!(bool)e.FieldValue) count++; e.TotalValue = count; } } } } } |
自定义模板列、滑动显示按钮
<dxGrid:GridControl
x:Name="grid"
ItemsSource="{Binding JDProduct}"
AllowResizeColumns="True"
AllowHorizontalScrollingVirtualization="True"
ColumnsAutoWidth="False"
SwipeButtonShowing="OnSwipeButtonShowing"
SwipeButtonClick="OnSwipeButtonClick"
>
<dxGrid:GridControl.Columns>
<dxGrid:TemplateColumn
FieldName="Name"
Caption ="112"
Width ="60"
IsReadOnly="true"
AllowGroup="False"
AllowSort="False" >
<dxGrid:TemplateColumn.DisplayTemplate>
<DataTemplate>
<Button
Text="{Binding Value}"
Clicked="nameClient"
BorderWidth="0"
BackgroundColor="Green"
TextColor="White"
></Button>
</DataTemplate>
</dxGrid:TemplateColumn.DisplayTemplate>
</dxGrid:TemplateColumn>
<dxGrid:TextColumn
FieldName="Name"
Caption = "名字"
Width = "100" />
<dxGrid:NumberColumn
FieldName="UnitPrice"
Caption = "价格"
DisplayFormat="C0"/>
<dxGrid:DateColumn
FieldName="Date"
DisplayFormat="d"/>
<dxGrid:SwitchColumn
FieldName="Shipped" />
<dxGrid:TextColumn
FieldName="Name"
Caption = "Product" />
<dxGrid:TextColumn
FieldName="Name"
Caption = "Product" />
<dxGrid:TextColumn
FieldName="Name"
Caption = "Product" />
<dxGrid:TextColumn
FieldName="Name"
Caption = "Product" />
<dxGrid:TextColumn
FieldName="Name"
Caption = "Product" />
<dxGrid:TextColumn
FieldName="Name"
Caption = "Product" />
</dxGrid:GridControl.Columns>
<dxGrid:GridControl.LeftSwipeButtons>
<dxGrid:SwipeButtonInfo
ButtonName="LeftButton"
Caption="打印"
BackgroundColor="Green"
Width="150"/>
</dxGrid:GridControl.LeftSwipeButtons>
</dxGrid:GridControl>
特殊说明:如果直接使用绑定的文本则使用 Value关键字,绑定对象则可以直接使用Value.XXX
后端.cs代码绑定事件
void OnSwipeButtonShowing(object sender, DevExpress.Mobile.DataGrid.SwipeButtonShowingEventArgs e)
{
if ((!(Boolean)grid.GetCellValue(e.RowHandle, "Shipped"))
&& (e.ButtonInfo.ButtonName == "RightButton"))
{
e.IsVisible = false;
}
}
void OnSwipeButtonClick(object sender, DevExpress.Mobile.DataGrid.SwipeButtonEventArgs e)
{
if (e.ButtonInfo.ButtonName == "LeftButton")
{
string orderDate = (string)grid.GetCellValue(e.RowHandle, " Name");
string orderDateDay = orderDate;
DisplayAlert("Alert from " + e.ButtonInfo.ButtonName, "Day: " + orderDateDay, "OK");
}
if (e.ButtonInfo.ButtonName == "RightButton")
{
grid.DeleteRow(e.RowHandle);
}
}
Xamarin devexpress datagrid 样式的更多相关文章
- WPF DataGrid 样式设置
隔行换色,鼠标单击,悬浮样式都有,其具体效果如图 1 所示. 图 1 WPF DataGrid 样式设置效果图 其中: 界面设计代码下所示 ? + 查看代码 1 2 3 4 5 6 7 8 9 10 ...
- DevExpress皮肤样式
[时间] 2016-02-15 11:41:11 天气晴 没有雾霾难得的好天气!!! [工具] (1)Visual Studio 2015 (2)DevExpress15.2.3 [感言] 一直以来都 ...
- WPF DataGrid 样式分享
原文:WPF DataGrid 样式分享 隔行换色,鼠标单击,悬浮样式都有 先看效果: 代码: <DataGrid AutoGenerateColumns="False" N ...
- Xamarin devexpress Grid
Devexpress 提供了datagrid 控件对于xamarin 进行支持.整个世界美好了,已经无法用语言来形容一个 被列表控件折磨的要死的人看到熟悉的图标时候的激动了.还有一点引用官网的原话: ...
- Xamarin.Forms DataGrid
控件出处 https://components.xamarin.com/ https://components.xamarin.com/gettingstarted/ZumeroDataGrid/tr ...
- WPF随手小记之二 ——改变DataGrid样式
大部分时候我们并不需要手动改变DataGrid的样式,因为用默认的其实也看得过去,而且在DataGrid中的数据也远比外观重要. 但总有时候,我们需要做点必要的UI修改来使DataGrid更美观. 一 ...
- Xamarin.Forms之样式
使用XAML样式设置Xamarin.Forms应用的样式Xamarin.Forms应用程序的样式传统上是通过使用Style类将一组属性值分组到一个对象中来完成的,然后可以将其应用于多个视觉元素实例. ...
- wpf 收集的不错的datagrid样式
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...
- DataGrid样式
1.自定义列(DataGridTemplateColumn) <DataGridTemplateColumn Width="130"> <DataGridTemp ...
随机推荐
- HTTP学习笔记6-请求报头
29,请求报头: 请求报头允许客户端向服务器端传递该请求的附加信息以及客户端自身的信息. 30,Accept: Accept请求报头域用于指定客户端接受哪类型的信息,例如:Accept: image/ ...
- Oracle 数据库基本操作——实用手册、表操作、事务操作、序列
目录: 0. 参考链接与参考手册1. oracle 实用(常用操作)指令2. 数据库基本操作语法 a) 表操作 1)创建表 2)更新表 3)删除表 4)查询 b) 事务操作 c) 序列操作 1)创建序 ...
- Liferay 6.1开发学习
http://www.huqiwen.com/2013/01/10/liferay-6-1-development-study-17-springmvc-portlet/ http://www.blo ...
- LAMP php5.4编译 _php_image_stream_putc等问题
编译时出现下列问题时: In file included from /usr/local/src/php-5.4.6/ext/gd/gd.c:103: /usr/local/src/php-5.4.6 ...
- C:应用于字符串处理函数
出于对C的不够熟悉,在读代码的过程中,平凡出现的字符串处理函数,成为了一个理解代码的大问题. 为了更方便的读取和理解代码,特意将接触到的字符串处理函数列出,方便查询: 1.strstr(str1,st ...
- 线段树---HDU1754 I hate it
这个题也是线段树的基础题,有了上一个题的基础,在做这个题就显得比较轻松了,大体都是一样的,那个是求和,这个改成求最大值,基本上思路差不多,下面是代码的实现 #include <cstdio> ...
- 补间动画 Interpolator 简介 示例
简介 补间动画的原理: 每次绘制视图时View所在的[ViewGroup]中的drawChild函数获取该View的Animation的值,然后调用canvas.concat (transformTo ...
- css06背景图片
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- codevs 3693 数三角形
/* n*m个点中选3个 再排除三点共线 共线分两类 1 在横线或者竖线上 m*C(n,3) n*C(m,3) 2 在对角线上 这个比较麻烦 以为对角线和矩阵是一一对应的 我们转化成求矩阵 并且保证有 ...
- excel导入mssql数据库,支持excel2003--2010文件格式
rt,简单的excel导入mssql.未做性能及海量数据优化,一般单表5000左右条数据导入适用. 源码非原创,来源于之前搜集整理,原作者无从考究,如有版权问题请留言注明. 看代码.前台页面是一个Fi ...



