当前位置: 首页 > news >正文

烟台电子商务网站营销团队外包

烟台电子商务网站,营销团队外包,独立网站做外贸报价,手机代理在listview的ComboBox,ViewModel类得不到ComboBox的 SelectedModeIndex 和 SelectionChanged事件。 问题描述: 1. 在listview中有ComboBox 2. 数据源类 InspectionInfo ,其中有ComboBox的绑定数据源 ModelList,代码如下&#…

在listview的ComboBox,ViewModel类得不到ComboBox的 SelectedModeIndex 和 SelectionChanged事件。

问题描述:

1. 在listview中有ComboBox

2.  数据源类 InspectionInfo ,其中有ComboBox的绑定数据源 ModelList,代码如下:

   public  class InspectionInfo : BindableBase{/// <summary>/// 模式名称列表 /// </summary>private ObservableCollection<BaseModeOption> _modelList;public ObservableCollection<BaseModeOption> ModelList{get{return _modelList;}set{SetProperty(ref _modelList, value);}}private ExamePartsStat _examePartInfo;public ExamePartsStat ExamePartInfo{get{return _examePartInfo;}set{SetProperty(ref _examePartInfo, value);}}private Inspection _currentInspection;/// <summary>/// 当前的多项检查/// </summary>public Inspection CurrentInspection{get => _currentInspection;set{SetProperty(ref _currentInspection, value);}}private int _selectedModeIndex = 0;public int SelectedModeIndex{get => _selectedModeIndex;set => SetProperty(ref _selectedModeIndex, value);}private DelegateCommand<object> _selectionModeChangedCommand;/// <summary>/// 模式改变事件/// </summary>public DelegateCommand<object> SelectionModeChangedCommand =>_selectionModeChangedCommand ??= new DelegateCommand<object>(ExecuteSelectionModeChangedCommand);/// <summary>/// 模式选择改变事件/// </summary>/// <param name="parameter"></param>private void ExecuteSelectionModeChangedCommand(object parameter){SharedViewModel shared = DI.Resolve<SharedViewModel>();shared.InvokeModeChangedCommand(SelectedModeIndex);}}

3. ViewModel类,构建了listView的数据源

private ObservableCollection<InspectionInfo> _inspectionInfoList;public ObservableCollection<InspectionInfo> InspectionInfoList{get => _inspectionInfoList;set => SetProperty(ref _inspectionInfoList, value);}

4. 页面绑定, ListView 绑定 InspectionInfoList, ComboBox的绑定数据源 ModelList,代码如下:

<ListView Grid.Row="0" Name="ItemList" ItemsSource="{Binding InspectionInfoList}" Background="#515151"  SelectedIndex="{Binding SelectedListItemIndex,Mode=TwoWay}" ><ListView.ItemContainerStyle><Style TargetType="ListViewItem"><Setter Property="Margin" Value="0,-40,0,40" /><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="ListBoxItem"><Border Background="{TemplateBinding Background}"><StackPanel ><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/><ColumnDefinition Width="150"/></Grid.ColumnDefinitions><TextBlock Text="{Binding Path=CurrentInspection.RegistrationNo}" Foreground="White" Grid.Row="1" Grid.Column="0"  Grid.ColumnSpan="2" HorizontalAlignment="left" VerticalAlignment="Center"/><ComboBox  Style="{StaticResource ComboBoxInPanelStyle}"  ItemsSource="{Binding ModelList}"   SelectedIndex="{Binding SelectedModeIndex,Mode=TwoWay}"  SelectedValuePath="Name"  DisplayMemberPath="Name" Grid.Row="1" Grid.Column="2"  SelectedValue="{Binding SelectedValue,Mode=TwoWay}"><be:Interaction.Triggers><be:EventTrigger EventName="SelectionChanged"><prism:InvokeCommandAction Command="{Binding SelectionModeChangedCommand}"/></be:EventTrigger></be:Interaction.Triggers></ComboBox></Grid></StackPanel></Border></ControlTemplate></Setter.Value></Setter><Style.Triggers><Trigger Property="IsSelected" Value="True"><Setter Property="Background" Value="#9C71B9" /><Setter Property="Foreground" Value="white" /></Trigger><Trigger Property="IsMouseOver" Value="True"><Setter Property="Background" Value="#1D1D1D" /><Setter Property="Foreground" Value="white" /></Trigger><Trigger Property="IsEnabled" Value="False"><Setter Property="Background" Value="#757575" /><Setter Property="Foreground" Value="white" /></Trigger></Style.Triggers></Style></ListView.ItemContainerStyle><be:Interaction.Triggers><be:EventTrigger EventName="SelectionChanged"><prism:InvokeCommandAction Command="{Binding Path=ListItemChangedCommand}"/></be:EventTrigger></be:Interaction.Triggers></ListView>

5. 问题是 ComboBox的 SelectedModeIndex 和 SelectionChanged  事件只能在InspectionInfo类中的得到,在ViewModel类中得不到。没办法,只能通过事件,在ViewModel中得到。

http://www.tj-hxxt.cn/news/18004.html

相关文章:

  • yellow高清免费观看在线郑州网站关键词优化公司哪家好
  • 怎么识别网站开发语言网站排名掉了怎么恢复
  • html网页导航栏模板360优化大师历史版本
  • 合肥做网站域名的公司企业管理培训
  • 产品信息发布网站百度公司官网招聘
  • 成都专业建设网站武汉seo引擎优化
  • 自己做网站排名好吗关键词优化靠谱推荐
  • 中关村网站建设公司站长之家ping
  • wordpress 美化无锡seo优化
  • 网站建设实训内容百度投放广告怎么收费
  • 做汽车网站销售怎么入手seo系统培训班
  • 长沙自助模板建站在线咨询 1 网站宣传
  • 简单网站制作实例河北seo推广公司
  • 有那种网站的浏览器发布外链
  • 黑客网站盗qq宁夏百度公司
  • 法院网站管理系统源码国内新闻大事20条简短
  • 做网站智能工具天津百度推广代理商
  • 医院做网站的意义怎么找当地的地推团队
  • 威宁网站建设企业查询官网
  • 用easyui做的网站信息流广告投放渠道
  • 工业设计就业广东培训seo
  • 世界十大网站开发公司北京网站优化服务
  • wordpress关注插件西安seo优化工作室
  • 怎么做dnf辅助网站百度推广官网登录
  • 网站建设的公司开发方案网站关键词优化软件效果
  • 公司的网站如何建设百度竞价推广屏蔽软件
  • 交友网站建设百度seo工作室
  • 闵行做网站公司铝棒易站公司站长工具网站查询
  • app定制价格保定seo网络推广
  • 昌平网站制作怎么注册电商平台