<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简单用法的更多相关文章

  1. C# Winfom 中ListBox的简单用法

    https://www.cnblogs.com/xielong/p/6744805.html Winform控件ListBox的用法 1.如何添加listBox的值 this.listBox1.Ite ...

  2. CATransition(os开发之画面切换) 的简单用法

    CATransition 的简单用法 //引进CATransition 时要添加包“QuartzCore.framework”,然后引进“#import <QuartzCore/QuartzCo ...

  3. jquery.validate.js 表单验证简单用法

    引入jquery.validate.js插件以及Jquery,在最后加上这个插件的方法名来引用.$('form').validate(); <!DOCTYPE html PUBLIC " ...

  4. NSCharacterSet 简单用法

    NSCharacterSet 简单用法 NSCharacterSet其实是许多字符或者数字或者符号的组合,在网络处理的时候会用到 NSMutableCharacterSet *base = [NSMu ...

  5. [转]Valgrind简单用法

    [转]Valgrind简单用法 http://www.cnblogs.com/sunyubo/archive/2010/05/05/2282170.html Valgrind的主要作者Julian S ...

  6. Oracle的substr函数简单用法

    substr(字符串,截取开始位置,截取长度) //返回截取的字 substr('Hello World',0,1) //返回结果为 'H'  *从字符串第一个字符开始截取长度为1的字符串 subst ...

  7. Ext.Net学习笔记19:Ext.Net FormPanel 简单用法

    Ext.Net学习笔记19:Ext.Net FormPanel 简单用法 FormPanel是一个常用的控件,Ext.Net中的FormPanel控件同样具有非常丰富的功能,在接下来的笔记中我们将一起 ...

  8. TransactionScope简单用法

    记录TransactionScope简单用法,示例如下: void Test() { using (TransactionScope scope = new TransactionScope()) { ...

  9. WPF之Treeview控件简单用法

    TreeView:表示显示在树结构中分层数据具有项目可展开和折叠的控件 TreeView 的内容是可以包含丰富内容的 TreeViewItem 控件,如 Button 和 Image 控件.TreeV ...

随机推荐

  1. 微信调试、API、AJAX的调试 SocketLog

    SocketLog适合Ajax调试和API调试, 举一个常见的场景,用SocketLog来做微信调试, 我们在做微信API开发的时候,如果API有bug,微信只提示"改公众账号暂时无法提供服 ...

  2. HDU 4003 [树][贪心][背包]

    /* 大连热身A题 不要低头,不要放弃,不要气馁,不要慌张 题意: 给一棵树,每条边上有权值.给一个起点,放置n个机器人,要求使得任意一个节点至少被一个机器人经过. 每个机器人经过某条边时的代价为这条 ...

  3. python——argsort函数

    numpy中argsort函数用法,有需要的朋友可以参考下. 在Python中使用help帮助 >>> import numpy >>> help(numpy.ar ...

  4. 学习indy组件之一idhttp的使用方法

    登录 注册 百度首页 新闻 网页 贴吧 知道 音乐 图片 视频 地图 百科 文库 经验 搜索答案我要提问 首页 分类 公社 知道行家 问医生 高质量问答 经验 个人中心手机知道开放平台   关于del ...

  5. 利用MyEclipse自动生成POJO和配置文件

    1.选择MyEclipse菜单的window菜单的Open Perspective,选择MyEclipse Database Explorer,如图所示. 2.在MySql上面点击右键,选择eidt. ...

  6. LPC2478调试___ads常见错误分析

    进行ADS外部RAM进行仿真调试过程中,出现常见错误“entry point lies  outside the image" 原因为程序空间超出范围,需要修改一个参数. 解决方法:首先在Z ...

  7. 【练习】数据移动---导入(IMPDP)

    1.导入表并验证: :: SYS@ORA11GR2>grant connect,resource to jj identified by jj; Grant succeeded. :: SYS@ ...

  8. APNS 服务推送通知

    1. 将app注册notification里面, 并从APNS上获取测试机的deviceToken. - (BOOL)application:(UIApplication *)application ...

  9. openwrt编译环境搭建

    1,首先安装ubuntu系统,这里安装的是虚拟机 2,安装openwrt编译所需环境  apt-get install build-essential libncures5-dev gawk libs ...

  10. 《Unix/Linux网络日志分析与流量监控》获2015年度最受读者喜爱的IT图书奖

    <Unix/Linux网络日志分析与流量监控>获2015年度最受读者喜爱的IT图书奖.刊登在<中华读书报>( 2015年01月28日 19 版) 我的2015年新作刊登在< ...