none
Datagrid 中列绑定CHECKBOX或文本框,单击单元格值神密消失了,我认为是一个BUG,而且很大的一个BUG,有解决方案的朋友肯请帮助了啊 RRS feed

  • 问题

  • 代码如下

     <sdk:DataGrid  Name="dataGrid1"  AutoGenerateColumns="False"   Margin="0,51,0,25"  RowHeight="25" >           

     <sdk:DataGrid.Columns >
                    <sdk:DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Header="大节" IsReadOnly="True" Width="45" Binding="{Binding k0}" />
                    <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"  Width="60" Header="组名">
                        <sdk:DataGridTemplateColumn.CellTemplate >
                            <DataTemplate >
                                <ComboBox  Name="cbfz"  Margin="2,1,1,1">
                           
                                </ComboBox>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"  Width="70" Header="占小节否">
                        <sdk:DataGridTemplateColumn.CellTemplate >
                            <DataTemplate >
                                <CheckBox  Name="cbsfyjc"   HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"  Width="90" Header="占用小节">
                        <sdk:DataGridTemplateColumn.CellTemplate >
                            <DataTemplate >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox  Width="25" Name="tbjc1" MaxLength="2" Margin="2,1,1,1"/>
                                    <TextBox  Width="25" Name="tbjc2" MaxLength="2" Margin="2,1,1,1"/>
                                    <TextBox  Width="25" Name="tbjc3" MaxLength="2"  Margin="2,1,1,1"/></StackPanel>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                  </sdk:DataGrid.Columns>
            </sdk:DataGrid>

    后台:

        class a
            {
                public string k0{get;set;}
            } 

                 List<a> m = new List<a>();
                m.Add(new a(){k0="0"});
                m.Add(new a(){k0="1"});
                dataGrid1.ItemsSource=m;

    1 在任何一个CHECKBOX上点击使其选中,然后在此单元格空白区点击两次,再然后在此DATAGRID任何其它单元格上单击,奇迹出现了,这个本来选中的checkbox竞然神密的被取消了选中,要命的是,这个取消不会触发任何的checkbox事件,包括click ischecked,unischecked事件,

    2, 我在第四列中包含了三个文本框,注意,三个文本框和被包含的单元格有一定的空隙,好了,我们在三个单元格中输入值,一切看起来很好,可是当你无意见点击单元格的空隙地方的,或你在此单元格的空隙点几次,再去其它单元格去点几次,再回来点几次(不确定),

    奇迹又出现了,此时你会发现这三个文本框中刚才你输入的值竞自动都被清空了。

    我现在想死了,那个每一列都显示CHECKBOX的功能,我几个每个业务介面都有此功能,

    开发都到一大半了,才发现这个问题,怎么办啊,有解决办法没有。。。。。

    2011年3月7日 1:06

答案

  • </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.TargetName="validationTooltip"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <System:Boolean>True</System:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid HorizontalAlignment="Left" VerticalAlignment="Top"> <Rectangle x:Name="Background" Fill="#FFFFFFFF" Height="14" Margin="1" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Width="14"/> <Rectangle x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Height="14" Margin="1" Opacity="0" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="14"/> <Rectangle x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Height="10" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="10"/> <Rectangle x:Name="BoxMiddle" Height="10" RadiusY="1" RadiusX="1" StrokeThickness="1" Width="10"> <Rectangle.Fill> <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15"> <GradientStop Color="#FFFFFFFF" Offset="0.013"/> <GradientStop Color="#F9FFFFFF" Offset="0.375"/> <GradientStop Color="#EAFFFFFF" Offset="0.603"/> <GradientStop Color="#D8FFFFFF" Offset="1"/> </LinearGradientBrush> </Rectangle.Fill> <Rectangle.Stroke> <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0"> <GradientStop Color="#FFFFFFFF" Offset="1"/> <GradientStop Color="#FFFFFFFF" Offset="0"/> <GradientStop Color="#FFFFFFFF" Offset="0.375"/> <GradientStop Color="#FFFFFFFF" Offset="0.375"/> </LinearGradientBrush> </Rectangle.Stroke> </Rectangle> <Rectangle x:Name="BoxMiddleLine" Height="10" Opacity=".2" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" Width="10"/> <Path x:Name="CheckIcon" Data="M102.03442,598.79645 L105.22962,597.78918 L106.78825,600.42358 C106.78825,600.42358 108.51028,595.74304 110.21724,593.60419 C112.00967,591.35822 114.89314,591.42316 114.89314,591.42316 C114.89314,591.42316 112.67844,593.42645 111.93174,594.44464 C110.7449,596.06293 107.15683,604.13837 107.15683,604.13837 z" Fill="#FF333333" FlowDirection="LeftToRight" Height="10" Margin="1,1,0,1.5" Opacity="0" Stretch="Fill" Width="10.5"/> <Rectangle x:Name="IndeterminateIcon" Fill="#FF333333" Height="2" Opacity="0" Width="6"/> <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Opacity="0" RadiusY="1" RadiusX="1" Width="14"/> <Rectangle x:Name="ContentFocusVisualElement" Height="16" IsHitTestVisible="false" Opacity="0" RadiusY="2" RadiusX="2" Stroke="#FF6DBDD1" StrokeThickness="1" Width="16"/> <Border x:Name="ValidationErrorElement" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" Margin="1" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed"> <ToolTipService.ToolTip> <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}"> <ToolTip.Triggers> <EventTrigger RoutedEvent="Canvas.Loaded"> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="validationTooltip"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <System:Boolean>true</System:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </ToolTip.Triggers> </ToolTip> </ToolTipService.ToolTip> <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10"> <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#FFDC000C" Margin="0,3,0,0"/> <Path Data="M 0,0 L2,0 L 7,5 L7,7" Fill="#ffffff" Margin="0,3,0,0"/> </Grid> </Border> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" Width="800"> <sdk:DataGrid x:Name="dataGrid1" AutoGenerateColumns="False" Margin="0,51,0,25" RowHeight="25" > <sdk:DataGrid.Columns > <sdk:DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Header="大节" IsReadOnly="True" Width="45" Binding="{Binding k0}" /> <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Width="60" Header="组名"> <sdk:DataGridTemplateColumn.CellTemplate > <DataTemplate > <ComboBox x:Name="cbfz" Margin="2,1,1,1"/> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Width="170" Header="占小节否"> <sdk:DataGridTemplateColumn.CellTemplate > <DataTemplate > <Grid Background="YellowGreen" MouseLeftButtonDown="Grid_MouseLeftButtonDown" Width="30"> <CheckBox x:Name="cbsfyjc" Indeterminate="cbsfyjc_Indeterminate" MouseLeftButtonDown="cbsfyjc_MouseLeftButtonDown" Style="{StaticResource CheckBoxStyle1}" IsChecked="{Binding IsChk,Mode=TwoWay}" LostFocus="cbsfyjc_LostFocus" IsEnabledChanged="cbsfyjc_IsEnabledChanged" Click="cbsfyjc_Click" Checked="cbsfyjc_Checked" Unchecked="cbsfyjc_Unchecked" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Width="90" Header="占用小节"> <sdk:DataGridTemplateColumn.CellTemplate > <DataTemplate > <StackPanel Orientation="Horizontal"> <TextBox Width="25" x:Name="tbjc1" MaxLength="2" Margin="2,1,1,1"/> <TextBox Width="25" x:Name="tbjc2" MaxLength="2" Margin="2,1,1,1"/> <TextBox Width="25" x:Name="tbjc3" MaxLength="2" Margin="2,1,1,1"/> </StackPanel> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> <CheckBox Content="CheckBox" HorizontalAlignment="Left" Height="16" Margin="64,16,0,0" VerticalAlignment="Top" Width="48" Style="{StaticResource CheckBoxStyle1}"/> <Button Content="Button" HorizontalAlignment="Left" Height="24" Margin="312,8,0,0" VerticalAlignment="Top" Width="88" Click="Button_Click"/> <sdk:Label x:Name="lblTest" Content="{Binding IsChk,Mode=TwoWay}" /> </Grid> </UserControl>
    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月10日 1:53
    版主

全部回复

  • 你的代码出错,导致DataGrid无法正常运行 类前面加上public就可以了(public class a). 为什么有个DataItem这个类,是因为我把你的类a重命名了!如果有什么问题你可以发我QQ.加油朋友. 编译器在运行时会报出如下错误: System.Windows.Data 错误: 无法从 'SilverlightApplication30.DataItem' (类型 'SilverlightApplication30.DataItem') 获得值 'k0' (类型 'System.String')。BindingExpression: Path='k0' DataItem='SilverlightApplication30.DataItem' (HashCode=44855704);目标元素为 'System.Windows.Controls.TextBlock' (Name='');目标属性为 'Text' (类型 'System.String')。。System.MethodAccessException: 方法“System.Windows.CLRPropertyListener.get_Value()”访问方法“SilverlightApplication30.DataItem.get_k0()”的尝试失败。 位于 System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags) 位于 System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, UInt32 invocationFlags) 位于 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 位于 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 位于 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) 位于 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) 位于 System.Windows.CLRPropertyListener.get_Value() 位于 System.Windows.PropertyAccessPathStep.ConnectToPropertyInSource(Boolean isSourceCollectionViewCurrentItem)。
    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月8日 16:21
    版主
  • 版主,你好,我那个后台代码类是随便举了个例子(后台我没有把我自己实际业务代码给贴上去),我想表达的是 前台,CHECKBOX或TEXTBOX被绑到DATAGRID中时,出现上面我描述的问题(另,我看不到你的QQ是多少啊)

    1 在任何一个CHECKBOX上点击使其选中,然后在此单元格空白区点击两次,再然后在此DATAGRID任何其它单元格上单击,奇迹出现了,这个本来选中的checkbox竞然神密的被取消了选中,要命的是,这个取消不会触发任何的checkbox事件,包括click ischecked,unischecked事件,

    2, 我在第四列中包含了三个文本框,注意,三个文本框和被包含的单元格有一定的空隙,好了,我们在三个单元格中输入值,一切看起来很好,可是当你无意见点击单元格的空隙地方的,或你在此单元格的空隙点几次,再去其它单元格去点几次,再回来点几次(不确定),

    奇迹又出现了,此时你会发现这三个文本框中刚才你输入的值竞自动都被清空了。

    在给datagrid做批量设置时,客户勾选了列表中checkbox,然后在checkbox所在的单元格边缘点两次,这个时候再去点其它单元格,那本来选中的checkbox就取消了选中,你是客户,你是什么怎么想,再如输入文本,人家本来是输入好的值,在单元格的边缘上点几次,那个输入的值的竞然没有了,你是使用者,你会怎么想

    2011年3月9日 4:19
  • QQ:283440946,加我!

     

     


    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月9日 14:25
    版主
  • 后台:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Diagnostics;
    using System.ComponentModel;
    
    namespace SilverlightApplication30
    {
      public partial class MainPage : UserControl
      {
        public MainPage()
        {
          InitializeComponent();
          this.Loaded += new RoutedEventHandler(MainPage_Loaded);
          this.lblTest.DataContext= new DataItem(){ k0 = "1", IsChk = true };
        }
       
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
          List<DataItem> m = new List<DataItem>();
          m.Add(new DataItem() { k0 = "0",IsChk=false });
          m.Add(new DataItem() { k0 = "1", IsChk = true });
          dataGrid1.ItemsSource = m;
    
          // (this.DataContext as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(MainPage_PropertyChanged);
        }
    
        private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
          Debug.WriteLine("Grid_MouseLeftButtonDown");
        }
    
        private void cbsfyjc_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_MouseLeftButtonDown");
        }
    
        private void cbsfyjc_Click(object sender, RoutedEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_Click");
        }
    
        private void cbsfyjc_Checked(object sender, RoutedEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_Checked");
        }
    
        private void cbsfyjc_Unchecked(object sender, RoutedEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_Unchecked");
        }
    
        private void cbsfyjc_Indeterminate(object sender, RoutedEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_Indeterminate");
        }
    
        private void cbsfyjc_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_IsEnabledChanged");
        }
    
        private void cbsfyjc_LostFocus(object sender, RoutedEventArgs e)
        {
          Debug.WriteLine("cbsfyjc_LostFocus");
        }
    
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
          // 在此处添加事件处理程序实现。
         
        }
    
        void MainPage_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
         // this.txt == e.ToString();
          Debug.WriteLine("");
        }
      }
      public class DataItem : INotifyPropertyChanged
      {
        public string k0 { get; set; }
        private bool? _isChk;
        public bool? IsChk
        {
          get { return _isChk; }
          set
          {
            _isChk = value;
            NotifyPropertyChanged("IsChk");
          }
        }
        public void NotifyPropertyChanged(string propertyName)
        {
          if (PropertyChanged != null)
          {
            PropertyChanged(this,
              new PropertyChangedEventArgs(propertyName));
          }
        }
    
    
        #region INotifyPropertyChanged Members
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        #endregion
      }
    }

    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月10日 1:47
    版主
  • 前台:
    <UserControl
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="SilverlightApplication30.MainPage"
      mc:Ignorable="d"
      d:DesignHeight="300" d:DesignWidth="400">
    
    	<UserControl.Resources>
    		<ControlTemplate x:Key="ValidationToolTipTemplate">
    			<Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
    				<Grid.RenderTransform>
    					<TranslateTransform x:Name="xform" X="-25"/>
    				</Grid.RenderTransform>
    				<VisualStateManager.VisualStateGroups>
    					<VisualStateGroup x:Name="OpenStates">
    						<VisualStateGroup.Transitions>
    							<VisualTransition GeneratedDuration="0"/>
    							<VisualTransition GeneratedDuration="0:0:0.2" To="Open">
    								<Storyboard>
    									<DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
    										<DoubleAnimation.EasingFunction>
    											<BackEase Amplitude=".3" EasingMode="EaseOut"/>
    										</DoubleAnimation.EasingFunction>
    									</DoubleAnimation>
    									<DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
    								</Storyboard>
    							</VisualTransition>
    						</VisualStateGroup.Transitions>
    						<VisualState x:Name="Closed">
    							<Storyboard>
    								<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
    							</Storyboard>
    						</VisualState>
    						<VisualState x:Name="Open">
    							<Storyboard>
    								<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
    								<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
    							</Storyboard>
    						</VisualState>
    					</VisualStateGroup>
    				</VisualStateManager.VisualStateGroups>
    				<Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
    				<Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
    				<Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
    				<Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
    				<Border Background="#FFDC000C" CornerRadius="2"/>
    				<Border CornerRadius="2">
    					<TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
    				</Border>
    			</Grid>
    		</ControlTemplate>
    		<Style x:Key="CheckBoxStyle1" TargetType="CheckBox">
    			<Setter Property="Background" Value="#FF448DCA"/>
    			<Setter Property="Foreground" Value="#FF000000"/>
    			<Setter Property="HorizontalContentAlignment" Value="Left"/>
    			<Setter Property="VerticalContentAlignment" Value="Top"/>
    			<Setter Property="Padding" Value="4,1,0,0"/>
    			<Setter Property="BorderThickness" Value="1"/>
    			<Setter Property="BorderBrush">
    				<Setter.Value>
    					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    						<GradientStop Color="#FFA3AEB9" Offset="0"/>
    						<GradientStop Color="#FF8399A9" Offset="0.375"/>
    						<GradientStop Color="#FF718597" Offset="0.375"/>
    						<GradientStop Color="#FF617584" Offset="1"/>
    					</LinearGradientBrush>
    				</Setter.Value>
    			</Setter>
    			<Setter Property="Template">
    				<Setter.Value>
    					<ControlTemplate TargetType="CheckBox">
    						<Grid HorizontalAlignment="Left" Width="16">
    							<Grid.ColumnDefinitions>
    								<ColumnDefinition Width="16"/>
    								<ColumnDefinition Width="*"/>
    							</Grid.ColumnDefinitions>
    							<VisualStateManager.VisualStateGroups>
    								<VisualStateGroup x:Name="CommonStates">
    									<VisualState x:Name="Normal"/>
    									<VisualState x:Name="MouseOver">
    										<Storyboard>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BoxMiddleBackground"/>
    											<ColorAnimation Duration="0" To="#7FFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#CCFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#F2FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    										</Storyboard>
    									</VisualState>
    									<VisualState x:Name="Pressed">
    										<Storyboard>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BoxMiddleBackground"/>
    											<ColorAnimation Duration="0" To="#6BFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#C6FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#EAFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#F4FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    											<ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
    										</Storyboard>
    									</VisualState>
    									<VisualState x:Name="Disabled">
    										<Storyboard>
    											<DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement"/>
    										</Storyboard>
    									</VisualState>
    								</VisualStateGroup>
    								<VisualStateGroup x:Name="CheckStates">
    									<VisualState x:Name="Checked">
    										<Storyboard>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckIcon"/>
    										</Storyboard>
    									</VisualState>
    									<VisualState x:Name="Unchecked"/>
    									<VisualState x:Name="Indeterminate">
    										<Storyboard>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="IndeterminateIcon"/>
    										</Storyboard>
    									</VisualState>
    								</VisualStateGroup>
    								<VisualStateGroup x:Name="FocusStates">
    									<VisualState x:Name="Focused">
    										<Storyboard>
    											<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentFocusVisualElement"/>
    										</Storyboard>
    									</VisualState>
    									<VisualState x:Name="Unfocused"/>
    								</VisualStateGroup>
    								<VisualStateGroup x:Name="ValidationStates">
    									<VisualState x:Name="Valid"/>
    									<VisualState x:Name="InvalidUnfocused">
    										<Storyboard>
    											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
    												<DiscreteObjectKeyFrame KeyTime="0">
    													<DiscreteObjectKeyFrame.Value>
    														<Visibility>Visible</Visibility>
    													</DiscreteObjectKeyFrame.Value>
    												</DiscreteObjectKeyFrame>
    											</ObjectAnimationUsingKeyFrames>
    										</Storyboard>
    									</VisualState>
    									<VisualState x:Name="InvalidFocused">
    										<Storyboard>
    											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
    												<DiscreteObjectKeyFrame KeyTime="0">
    													<DiscreteObjectKeyFrame.Value>
    														<Visibility>Visible</Visibility>
    													</DiscreteObjectKeyFrame.Value>
    												</DiscreteObjectKeyFrame>
    
    
    



    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月10日 1:50
    版主
  • </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.TargetName="validationTooltip"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <System:Boolean>True</System:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid HorizontalAlignment="Left" VerticalAlignment="Top"> <Rectangle x:Name="Background" Fill="#FFFFFFFF" Height="14" Margin="1" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Width="14"/> <Rectangle x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Height="14" Margin="1" Opacity="0" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="14"/> <Rectangle x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Height="10" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="10"/> <Rectangle x:Name="BoxMiddle" Height="10" RadiusY="1" RadiusX="1" StrokeThickness="1" Width="10"> <Rectangle.Fill> <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15"> <GradientStop Color="#FFFFFFFF" Offset="0.013"/> <GradientStop Color="#F9FFFFFF" Offset="0.375"/> <GradientStop Color="#EAFFFFFF" Offset="0.603"/> <GradientStop Color="#D8FFFFFF" Offset="1"/> </LinearGradientBrush> </Rectangle.Fill> <Rectangle.Stroke> <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0"> <GradientStop Color="#FFFFFFFF" Offset="1"/> <GradientStop Color="#FFFFFFFF" Offset="0"/> <GradientStop Color="#FFFFFFFF" Offset="0.375"/> <GradientStop Color="#FFFFFFFF" Offset="0.375"/> </LinearGradientBrush> </Rectangle.Stroke> </Rectangle> <Rectangle x:Name="BoxMiddleLine" Height="10" Opacity=".2" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" Width="10"/> <Path x:Name="CheckIcon" Data="M102.03442,598.79645 L105.22962,597.78918 L106.78825,600.42358 C106.78825,600.42358 108.51028,595.74304 110.21724,593.60419 C112.00967,591.35822 114.89314,591.42316 114.89314,591.42316 C114.89314,591.42316 112.67844,593.42645 111.93174,594.44464 C110.7449,596.06293 107.15683,604.13837 107.15683,604.13837 z" Fill="#FF333333" FlowDirection="LeftToRight" Height="10" Margin="1,1,0,1.5" Opacity="0" Stretch="Fill" Width="10.5"/> <Rectangle x:Name="IndeterminateIcon" Fill="#FF333333" Height="2" Opacity="0" Width="6"/> <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Opacity="0" RadiusY="1" RadiusX="1" Width="14"/> <Rectangle x:Name="ContentFocusVisualElement" Height="16" IsHitTestVisible="false" Opacity="0" RadiusY="2" RadiusX="2" Stroke="#FF6DBDD1" StrokeThickness="1" Width="16"/> <Border x:Name="ValidationErrorElement" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" Margin="1" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed"> <ToolTipService.ToolTip> <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}"> <ToolTip.Triggers> <EventTrigger RoutedEvent="Canvas.Loaded"> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="validationTooltip"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <System:Boolean>true</System:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </ToolTip.Triggers> </ToolTip> </ToolTipService.ToolTip> <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10"> <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#FFDC000C" Margin="0,3,0,0"/> <Path Data="M 0,0 L2,0 L 7,5 L7,7" Fill="#ffffff" Margin="0,3,0,0"/> </Grid> </Border> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" Width="800"> <sdk:DataGrid x:Name="dataGrid1" AutoGenerateColumns="False" Margin="0,51,0,25" RowHeight="25" > <sdk:DataGrid.Columns > <sdk:DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Header="大节" IsReadOnly="True" Width="45" Binding="{Binding k0}" /> <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Width="60" Header="组名"> <sdk:DataGridTemplateColumn.CellTemplate > <DataTemplate > <ComboBox x:Name="cbfz" Margin="2,1,1,1"/> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Width="170" Header="占小节否"> <sdk:DataGridTemplateColumn.CellTemplate > <DataTemplate > <Grid Background="YellowGreen" MouseLeftButtonDown="Grid_MouseLeftButtonDown" Width="30"> <CheckBox x:Name="cbsfyjc" Indeterminate="cbsfyjc_Indeterminate" MouseLeftButtonDown="cbsfyjc_MouseLeftButtonDown" Style="{StaticResource CheckBoxStyle1}" IsChecked="{Binding IsChk,Mode=TwoWay}" LostFocus="cbsfyjc_LostFocus" IsEnabledChanged="cbsfyjc_IsEnabledChanged" Click="cbsfyjc_Click" Checked="cbsfyjc_Checked" Unchecked="cbsfyjc_Unchecked" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False" Width="90" Header="占用小节"> <sdk:DataGridTemplateColumn.CellTemplate > <DataTemplate > <StackPanel Orientation="Horizontal"> <TextBox Width="25" x:Name="tbjc1" MaxLength="2" Margin="2,1,1,1"/> <TextBox Width="25" x:Name="tbjc2" MaxLength="2" Margin="2,1,1,1"/> <TextBox Width="25" x:Name="tbjc3" MaxLength="2" Margin="2,1,1,1"/> </StackPanel> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> <CheckBox Content="CheckBox" HorizontalAlignment="Left" Height="16" Margin="64,16,0,0" VerticalAlignment="Top" Width="48" Style="{StaticResource CheckBoxStyle1}"/> <Button Content="Button" HorizontalAlignment="Left" Height="24" Margin="312,8,0,0" VerticalAlignment="Top" Width="88" Click="Button_Click"/> <sdk:Label x:Name="lblTest" Content="{Binding IsChk,Mode=TwoWay}" /> </Grid> </UserControl>
    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月10日 1:53
    版主
  • 要不你试试!

    微软论坛一次只能发6万字,所以我只有分几次发给你了


    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年3月10日 2:04
    版主
  • QQ里,上个月我已经给你回复了!

    你一直没有把答复标记,我就冒昧的把自己标记了^_^


    努力!完成了js解析器,还差一个svg插件,一个绘图程序,做好自己,呵呵~!
    2011年7月11日 5:30
    版主