Listbox简单用法
<ListBox x:Name="ListBoxPatientAllergy" Grid.Row="1"
ItemContainerStyle="{StaticResource ListboxStyle}"
Background="Transparent" BorderThickness="0"
Foreground="Black"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.PanningMode="None"
ItemsSource="{Binding Path=PatientAllergyEntityList}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<sync:DateTimeEdit x:Name="dpPatientAllergy"
Height="28" Width="100" Margin="0,0,0,5"
DateTime="{Binding Path=Date, Mode=TwoWay}"
CustomPattern="dd MMM yyyy"
MinDateTime="01 Jan 1800"/>
<TextBox Name="TxtPatientAllergy" Grid.Column="1"
HorizontalAlignment="Stretch" Height="28"
MaxLength="100" Margin="2,0,0,5" VerticalContentAlignment="Center"
Validation.Error="Validation_Error"
Text="{Binding Path=Description,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True}"/>
<ComboBox Name="CmbPatientAllergy" Grid.Column="2" VerticalContentAlignment="Center"
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
Background="White" Margin="2,0,0,5" Height="28"
ItemsSource="{Binding RelativeSource={RelativeSource Findancestor, AncestorType={x:Type UserControl}}, Path=DataContext.CodeTables.CTPatientAllergyStatusEntityList}"
DisplayMemberPath="DisplayValue"
SelectedValuePath="PatientAllergyStatusID"
SelectedValue="{Binding Path=PatientAllergyStatusFK, Mode=TwoWay}"/>
<Button x:Name="BtnDeletePatientAllergy" Grid.Column="3"
Margin="2,2,2,5" BorderThickness="0" BorderBrush="White" HorizontalAlignment="Center"
Height="28" Width="30"
Click="BtnDeletePatientAllergy_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Image Width="24" Height="24"
HorizontalAlignment="Center" VerticalAlignment="Center"
Source="pack://application:,,,/Medisys.SEMR.WPFClient.Controls.Resource;component/Image/DeleteIcon.png" />
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
事件:
private void BtnDeletePatientAllergy_Click(object sender, RoutedEventArgs e)
{
object obj = ((Button)sender).DataContext;
if (obj == null)
return;
else
{
PatientAllergyEntity PatientAllergyEntity = obj as PatientAllergyEntity;
if (PatientAllergyEntityList != null
&& PatientAllergyEntity.PatientAllergyID != null && PatientAllergyEntity.PatientAllergyID != Guid.Empty)
{
PatientAllergyEntityList.Remove(PatientAllergyEntity);
}
}
}
Listbox简单用法的更多相关文章
- C# Winfom 中ListBox的简单用法
https://www.cnblogs.com/xielong/p/6744805.html Winform控件ListBox的用法 1.如何添加listBox的值 this.listBox1.Ite ...
- CATransition(os开发之画面切换) 的简单用法
CATransition 的简单用法 //引进CATransition 时要添加包“QuartzCore.framework”,然后引进“#import <QuartzCore/QuartzCo ...
- jquery.validate.js 表单验证简单用法
引入jquery.validate.js插件以及Jquery,在最后加上这个插件的方法名来引用.$('form').validate(); <!DOCTYPE html PUBLIC " ...
- NSCharacterSet 简单用法
NSCharacterSet 简单用法 NSCharacterSet其实是许多字符或者数字或者符号的组合,在网络处理的时候会用到 NSMutableCharacterSet *base = [NSMu ...
- [转]Valgrind简单用法
[转]Valgrind简单用法 http://www.cnblogs.com/sunyubo/archive/2010/05/05/2282170.html Valgrind的主要作者Julian S ...
- Oracle的substr函数简单用法
substr(字符串,截取开始位置,截取长度) //返回截取的字 substr('Hello World',0,1) //返回结果为 'H' *从字符串第一个字符开始截取长度为1的字符串 subst ...
- Ext.Net学习笔记19:Ext.Net FormPanel 简单用法
Ext.Net学习笔记19:Ext.Net FormPanel 简单用法 FormPanel是一个常用的控件,Ext.Net中的FormPanel控件同样具有非常丰富的功能,在接下来的笔记中我们将一起 ...
- TransactionScope简单用法
记录TransactionScope简单用法,示例如下: void Test() { using (TransactionScope scope = new TransactionScope()) { ...
- WPF之Treeview控件简单用法
TreeView:表示显示在树结构中分层数据具有项目可展开和折叠的控件 TreeView 的内容是可以包含丰富内容的 TreeViewItem 控件,如 Button 和 Image 控件.TreeV ...
随机推荐
- Microsoft JScript 运行时错误: '$' 未定义
在运行MVC Music Store时Visual Studio 捕捉到此错误: Microsoft JScript 运行时错误: '$' 未定义 可能是引用的Scripts 引用出错,检查当前文件中 ...
- Redis复制与可扩展集群搭建
抄自:http://www.infoq.com/cn/articles/tq-redis-copy-build-scalable-cluster 讨论了Redis的常用数据类型与存储机制,本文会讨论一 ...
- 每天一个 Linux 命令(20):find命令之exec
find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是command ...
- Java 判断文件夹、文件是否存在、否则创建文件夹
1.判断文件是否存在,不存在创建文件 File file=new File("C:\\Users\\QPING\\Desktop\\JavaScript\\2.htm"); if( ...
- Arduino 翻译系列 - LED 灯闪烁
原文地址 - https://www.arduino.cc/en/Tutorial/Blink 闪烁 这个例子展示了你能拿 Arduino / Genuino 板子来干的最简单的事:使开发板上的 LE ...
- vbox下创建共享存储
1.创建共享盘VBoxManage.exe createhd -filename D:\VM\linux01\ocr_vote.vdi -size 2048 -format VDI -variant ...
- Codeforces 28C [概率DP]
/* 大连热身D题 题意: 有n个人,m个浴室每个浴室有ai个喷头,每个人等概率得选择一个浴室. 每个浴室的人都在喷头前边排队,而且每个浴室内保证大家都尽可能均匀得在喷头后边排队. 求所有浴室中最长队 ...
- Git Pro - (1) 基础
近乎所有操作都可本地执行 在Git中的绝大多数操作都只需要访问本地文件和资源,不用连网. 三种状态 对于任何一个文件,在 Git 内都只有三 种状态:已提交(committed),已修改(modifi ...
- delphi.位操作
位操作网上有很多介绍,请上网google/baidu,比如: 位操作技巧实例大全: http://blog.csdn.net/g_spider/article/details/5750665 位操作基 ...
- 封装tip控件
在界面上有时需要显示一个提示,大多的前端框架都把提示做成一个带有小尖角的提示框,因此自己也仿照了实现了一下,效果图如下: 尖角的实现很简单的,一般都是通过css将div的宽高设置为0,然后将尖角朝向的 ...