找回密码
 立即注册

QQ登录

只需一步,快速开始

xinren063

高级会员

46

主题

209

帖子

1378

积分

高级会员

积分
1378

活字格认证

xinren063
高级会员   /  发表于:2014-7-18 11:14  /   查看:12254  /  回复:13
现在控件的Template里加入了VisualStateManager.VisualStateGroups,里面包含了大量的动画,有什么方法可以禁用VisualStateManager.VisualStateGroups,或者去掉VisualStateManager.VisualStateGroups里的动画

13 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2014-7-18 13:55:00
沙发
回复 1楼xinren063的帖子

请你提供更详细信息:请问是C1的哪个控件,你需要禁用所有的动画还是哪种动画效果?平台是什么(WPF,Silverlight)?
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
xinren063
高级会员   /  发表于:2014-7-18 14:33:00
板凳
WPF 基本所有控件都有动画
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2014-7-18 17:43:00
地板
回复 3楼xinren063的帖子

这些是设置在ControlTemplate里的,你需要重写所有控件的ControlTemplate。
打开文件夹C:\Program Files (x86)\ComponentOne\Studio for WPF\C1WPF.4\XAML
可以找到我们所有控件的ControlTemplate
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
xinren063
高级会员   /  发表于:2014-7-21 16:06:00
5#
可以简单的给个重写控件ControlTemplate的示例吗,可以以C1FlexGrid为例吗?大量使用了这个控件
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2014-7-22 15:51:00
6#
回复 5楼xinren063的帖子

1.打开C:\Program Files (x86)\ComponentOne\Studio for WPF\C1WPFFlexGrid.4\XAML
2.打开Generic.xmal文件,代码如下:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:C1.WPF.FlexGrid">

  3.     <!-- brushes -->
  4.   <SolidColorBrush x:Key="_RowBackground" Color="#C0E0E0E0" />
  5.   <SolidColorBrush x:Key="_AlternatingRowBackground" Color="#00FFFFFF" />
  6.   <SolidColorBrush x:Key="_HeaderGridLinesBrush" Color="#E0C8C8C8" />
  7.   <SolidColorBrush x:Key="_GridLinesBrush" Color="#FFF0F0F0" />
  8.   <SolidColorBrush x:Key="_FrozenLinesBrush" Color="#E0000000" />
  9.   <SolidColorBrush x:Key="_GroupRowBackground" Color="#E0E4E4E4" />
  10.   <SolidColorBrush x:Key="_CursorBackground" Color="#FFBADDE9" />
  11.   <SolidColorBrush x:Key="_SelectionBackground" Color="#A0BADDE9" />

  12.   <Color x:Key="_gradFrom">#F0FAFAFA</Color>
  13.   <Color x:Key="_gradTo">#F0DBDBDB</Color>
  14.   <LinearGradientBrush x:Key="_RowHeaderBackground" EndPoint="1.5,0">
  15.     <GradientStop Color="{StaticResource _gradFrom}" Offset="0" />
  16.     <GradientStop Color="{StaticResource _gradTo}" Offset="1" />
  17.   </LinearGradientBrush>
  18.   <LinearGradientBrush x:Key="_ColumnHeaderBackground" EndPoint="0,1">
  19.     <GradientStop Color="{StaticResource _gradFrom}" Offset="0" />
  20.     <GradientStop Color="{StaticResource _gradTo}" Offset="1" />
  21.   </LinearGradientBrush>
  22.   <LinearGradientBrush x:Key="_TopLeftCellBackground" EndPoint="1,1">
  23.     <GradientStop Color="{StaticResource _gradFrom}" Offset="0" />
  24.     <GradientStop Color="{StaticResource _gradTo}" Offset="1" />
  25.   </LinearGradientBrush>
  26.   <LinearGradientBrush x:Key="_BottomRightCellBackground" EndPoint="1,1">
  27.     <GradientStop Color="{StaticResource _gradTo}" Offset="0" />
  28.     <GradientStop Color="{StaticResource _gradFrom}" Offset="1" />
  29.   </LinearGradientBrush>

  30.   <!-- control definition -->
  31.   <Style TargetType="local:C1FlexGrid">

  32.     <!-- properties -->
  33.     <Setter Property="Background" Value="White" />
  34.     <Setter Property="RowBackground" Value="{StaticResource _RowBackground}" />
  35.     <Setter Property="AlternatingRowBackground" Value="{StaticResource _AlternatingRowBackground}" />
  36.     <Setter Property="HeaderGridLinesBrush" Value="{StaticResource _HeaderGridLinesBrush}" />
  37.     <Setter Property="GridLinesBrush" Value="{StaticResource _GridLinesBrush}" />
  38.     <Setter Property="FrozenLinesBrush" Value="{StaticResource _FrozenLinesBrush}" />
  39.     <Setter Property="GroupRowBackground" Value="{StaticResource _GroupRowBackground}" />
  40.     <Setter Property="CursorBackground" Value="{StaticResource _CursorBackground}" />
  41.     <Setter Property="SelectionBackground" Value="{StaticResource _SelectionBackground}" />
  42.     <Setter Property="RowHeaderBackground" Value="{StaticResource _RowHeaderBackground}" />
  43.     <Setter Property="ColumnHeaderBackground" Value="{StaticResource _ColumnHeaderBackground}" />
  44.     <Setter Property="TopLeftCellBackground" Value="{StaticResource _TopLeftCellBackground}" />
  45.     <Setter Property="BottomRightCellBackground" Value="{StaticResource _BottomRightCellBackground}" />

  46.     <!-- template -->
  47.     <Setter Property="Template">
  48.       <Setter.Value>
  49.         <ControlTemplate TargetType="local:C1FlexGrid">
  50.           <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
  51.                   <!--CornerRadius="2">-->
  52.             <Grid x:Name="_root">
  53.               <Grid.RowDefinitions>
  54.                 <RowDefinition Height="Auto" />
  55.                 <RowDefinition Height="*" />
  56.                 <RowDefinition Height="Auto" />
  57.                 <RowDefinition Height="Auto" />
  58.               </Grid.RowDefinitions>
  59.               <Grid.ColumnDefinitions>
  60.                 <ColumnDefinition Width="Auto" />
  61.                 <ColumnDefinition Width="*" />
  62.                 <ColumnDefinition Width="Auto" />
  63.               </Grid.ColumnDefinitions>
  64.               <ScrollBar x:Name="_sbV" Orientation="Vertical" Grid.Column="2" Grid.RowSpan="3" />
  65.               <ScrollBar x:Name="_sbH" Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="2" />
  66.             </Grid>
  67.           </Border>
  68.         </ControlTemplate>
  69.       </Setter.Value>
  70.     </Setter>
  71.   </Style>
  72. </ResourceDictionary>
复制代码

这段代码有C1FlexGrid的动画效果,包含TopLeftCellBackground等。
3.在你的工程里添加一个Generic.xmal文件,步骤二里的代码就是一个重写的范例。参考步骤二中的代码,改写代码。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
xinren063
高级会员   /  发表于:2014-7-22 17:04:00
7#
C1FlexGrid的模板这么简单,是不是有些资源没写在里面,行的模板、列的模板、单元格的模板等在哪里,或者是怎样的?
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2014-7-23 09:37:00
8#
回复 7楼xinren063的帖子

我们C1FlexGrid的模板就在上面的代码里面,包含分行分列,如果你需要别的属性或是增加需求,可以自己定义。
还是我理解的不对。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
xinren063
高级会员   /  发表于:2014-7-24 14:20:00
9#
对于这个C1FlexGrid的模板,我认为这边只是最外层的框架,至于里面的行、列、单元格等的模板应该不在这里面,不知道是不是另外有什么地方设置了,或者采用不同的方式加载了
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2014-7-24 15:19:00
10#
回复 9楼xinren063的帖子

C1的列,行,单元格的模板可以通过代码实现。比如C1FlexGrid.Columns.CellTemplate, 下面的XMAL代码演示如何设置某一列的模板,编辑状态和非编辑状态是不一样的模板。
  1.    <c1:C1FlexGrid      Name="_flex"      ItemsSource="{Binding Products}"
  2.       AutoGenerateColumns="False">
  3.       <c1:C1FlexGrid.Columns>     
  4.         <!--
  5.           Category column uses a CellEditingTemplate with a ComboBox.
  6.           The ComboBox uses an ItemTemplate to show images and text.
  7.           The ComboBox has IsSynchronizedWithCurrentItem=false to keep it from
  8.           changing the selected item in the single "Categories" collection.
  9.           -->
  10.         <c1:Column Header="Category" Width="200" >
  11.           <c1:Column.CellTemplate>
  12.             <DataTemplate>
  13.               <Grid Margin="4 0">
  14.                 <Grid.ColumnDefinitions>
  15.                   <ColumnDefinition Width="25"/>
  16.                   <ColumnDefinition />
  17.                 </Grid.ColumnDefinitions>
  18.                 <Image Source="{Binding Category.Picture}" />
  19.                 <TextBlock Grid.Column="1" Margin="4 0 0 0" VerticalAlignment="Center" Text="{Binding Category.CategoryName}" />
  20.               </Grid>
  21.             </DataTemplate>
  22.           </c1:Column.CellTemplate>
  23.           <c1:Column.CellEditingTemplate>
  24.             <DataTemplate>
  25.               <ComboBox
  26.                 ItemsSource="{Binding Categories, Source={StaticResource _vm}}"
  27.                 SelectedValue="{Binding Category}"
  28.                 IsSynchronizedWithCurrentItem="False" >
  29.                 <ComboBox.ItemTemplate>
  30.                   <DataTemplate>
  31.                     <Grid>
  32.                       <Grid.ColumnDefinitions>
  33.                         <ColumnDefinition Width="25"/>
  34.                         <ColumnDefinition />
  35.                       </Grid.ColumnDefinitions>
  36.                       <Image Source="{Binding Picture}" />
  37.                       <TextBlock Grid.Column="1" Margin="4 0 0 0" VerticalAlignment="Center" Text="{Binding CategoryName}" />
  38.                     </Grid>
  39.                   </DataTemplate>
  40.                 </ComboBox.ItemTemplate>
  41.               </ComboBox>
  42.             </DataTemplate>
  43.           </c1:Column.CellEditingTemplate>
  44.         </c1:Column>
  45. <c1:C1FlexGrid.Columns/>   
  46. <c1:C1FlexGrid/>   
复制代码
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部