WPF日积月累之DataGrid样式以及操作数据模板中的控件
2021-01-17 12:15
阅读:489
标签:none art border NPU openxml layout vat grid obs
一、效果图
二、代码预览


1"Test.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 6 xmlns:local="clr-namespace:Test" 7 mc:Ignorable="d" 8 Title="MainWindow" Height="450" Width="800"> 9 10 12"text2ImageConverter"> 11"10"> 13 149"3 0 3 0" Name="dataGridTestCase" ItemsSource="{Binding CaseCollection}" BorderThickness="0" 14 AutoGenerateColumns="False" CanUserAddRows = "False" SelectedIndex="{Binding SelIndex,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" RowHeaderWidth="0"> 15 14816 31 3233 47 48 4950 66 6768 81 82 8384 146 147"" MinWidth="8" Width="8" MaxWidth="8"> 85 97 9886 9687 94 95"用例描述" MinWidth="373" > 99 105 106100 104101 102 103"结果" Width="40"> 107 113108 112109 111"{Binding TestResult, Converter={StaticResource text2ImageConverter},ConverterParameter=0}" Width="20" Height="20">110
"操作" Width="50" > 114 145115 144116 143"Horizontal" HorizontalAlignment="Center"> 117 141 142


1 using System; 2 using System.Collections.Generic; 3 using System.Collections.ObjectModel; 4 using System.ComponentModel; 5 using System.Globalization; 6 using System.Linq; 7 using System.Text; 8 using System.Windows; 9 using System.Windows.Controls; 10 using System.Windows.Data; 11 using System.Windows.Documents; 12 using System.Windows.Input; 13 using System.Windows.Media; 14 using System.Windows.Media.Imaging; 15 using System.Windows.Navigation; 16 using System.Windows.Shapes; 17 18 namespace Test 19 { 20 21 ///22 /// MainWindow.xaml 的交互逻辑 23 /// 24 public partial class MainWindow : Window, INotifyPropertyChanged 25 { 26 #region INotifyPropertyChanged interface 27 public event PropertyChangedEventHandler PropertyChanged; 28 public virtual void OnPropertyChanged(string propertyName) 29 { 30 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 31 } 32 #endregion 33 public ObservableCollection CaseCollection { get; set; } 34 private int preSelIndex = 0; 35 private int selIndex = -1; 36 public int SelIndex 37 { 38 get 39 { 40 return selIndex; 41 } 42 set 43 { 44 if(value != selIndex) 45 { 46 selIndex = value; 47 48 DataGridRow preRow = GetRow(dataGridTestCase, preSelIndex); 49 Label preLb = FindVisualChildByName
WPF日积月累之DataGrid样式以及操作数据模板中的控件
标签:none art border NPU openxml layout vat grid obs
原文地址:https://www.cnblogs.com/3xiaolonglong/p/12199746.html
下一篇:c#关于路径的总结
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:WPF日积月累之DataGrid样式以及操作数据模板中的控件
文章链接:http://soscw.com/essay/43192.html
文章标题:WPF日积月累之DataGrid样式以及操作数据模板中的控件
文章链接:http://soscw.com/essay/43192.html
评论
亲,登录后才可以留言!