<Style x:Key="OrderGroupTemplateStyle" TargetType="{x:Type ContentControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Name.ShowDetailedInfo, UpdateSourceTrigger=PropertyChanged}" Value="False">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Border BorderBrush="Gray" BorderThickness="2" CornerRadius="3" Margin="2">
<StackPanel Background="LightGoldenrodYellow">
<ContentControl Content="{Binding Path=.}" Style="{StaticResource MyRecordViewModelShortStyle}"/>
<ListView ItemsSource="{Binding Path=Items}" Margin="4">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="Padding" Value="2"/>
<EventSetter Event="MouseDoubleClick" Handler="ItemsControl_SelectionChanged"/>
</Style>
</ListView.ItemContainerStyle>
Run Code Online (Sandbox Code Playgroud)
当listview选择改变时,我想做一些工作.因为我正在使用样式我不能在ListView上使用SelectionChanged事件.我尝试使用EventSetter但编译项目时出现任何错误:
无法在样式中的Target标记上指定事件"MouseDoubleClick".请改用EventSetter.
有人可以帮帮我吗?
我有一个网格和一个表单,每次我们在该网格上选择一行时,我需要在表单上显示不同的项目
我一直在寻找如何做到这一点,并找到了
Ext.getCmp('myform').hide() // or .show()
Run Code Online (Sandbox Code Playgroud)
和
listeners: { selectionchange: function () {...}
Run Code Online (Sandbox Code Playgroud)
现在我不知道选择了哪一行,所以我可以指定要显示的项目
谢谢
我需要为WinRT应用程序中的列表和组合框实现选择更改事件.我使用的是MvvmCross,但AFAIK这是一个WinRT而不是Mvx特定的问题.System.Windows.Interactivity不适用于WinRT应用程序,因此我无法使用基于i:Interaction.Triggers的技术.我希望以真正的MVVM方式实现绑定,而无需切换到代码隐藏,因此我可以在其他平台上尽可能多地重用.在WinRT应用程序中实现它的合理方法是什么?我没有在MvvmCross样本中找到任何示例.
提前致谢
我在windows手机中使用此代码创建listpicker.
<StackPanel Height="148" Margin="0,100,0,0">
<toolkit:ListPicker Grid.Row="0" FontFamily="Segoe WP Semibold" Height="176" x:Name="Additional_Time" ItemTemplate="{StaticResource PickerItemTemplate}" FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" FullModeHeader="Cities" SelectedIndex="0" CacheMode="BitmapCache" Header="Choose Exit Time" FontSize="30" SelectionChanged="Additional_Time_SelectionChanged"/>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
并使用此网格资源
<Grid.Resources>
<DataTemplate x:Name="PickerItemTemplate">
<StackPanel Orientation="Horizontal">
<Border Background="LightGreen" Width="34" Height="34">
<TextBlock Text="{Binding Country}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<TextBlock Text="{Binding Name}" Margin="12 0 0 0"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Name="PickerFullModeItemTemplate">
<StackPanel Orientation="Horizontal" Margin="16 21 0 20">
<TextBlock Text="{Binding Name}" Margin="16 0 0 0" FontSize="43" FontFamily="{StaticResource PhoneFontFamilyLight}"/>
<TextBlock Text="{Binding Language}" Foreground="Green"/>
</StackPanel>
</DataTemplate>
</Grid.Resources>
Run Code Online (Sandbox Code Playgroud)
下面的代码用于将项目插入到listpicker中
List<Cities> source = new …Run Code Online (Sandbox Code Playgroud) 我有列表视图控件,在更改选择时,我会检查 - 如果所选记录计数大于零,则仅启用组框控件,否则将其禁用。因为,这些控件仅与选定的记录相关。如果没有选择记录,则不应启用它。
以下是我的列表视图的选定更改事件:
Private Sub lv_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lv.SelectedIndexChanged
If lv.SelectedItems.Count() > 0 Then
...
.
ResetifNorecordSelectedState(False)
Else
..
ResetifNorecordSelectedState(True)
End If
Run Code Online (Sandbox Code Playgroud)
问题:每次用户更改记录选择时,控件都会被禁用并随后进入启用状态。这给用户带来了一些不方便的设计。
任何人都可以分享我的解决方案,或者我应该在这里更改什么来纠正这个问题。?
谢谢