我正在使用一个ObservableCollection带有两个ICollectionView不同的过滤器.
一种用于按某种类型过滤消息,一种用于计算已检查的消息.正如您所看到的,消息过滤器和消息计数工作正常,但是当我取消检查时,消息将从列表中消失(计数仍然有效).
对于这篇长篇文章,我很抱歉,我想包括所有相关内容.
XAML代码:
<!-- Messages List -->
<DockPanel Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="3"
Height="500">
<ListBox Name="listBoxZone"
ItemsSource="{Binding filteredMessageList}"
Background="Transparent"
BorderThickness="0">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Name="CheckBoxZone"
Content="{Binding text}"
Tag="{Binding id}"
Unchecked="CheckBoxZone_Unchecked"
Foreground="WhiteSmoke"
Margin="0,5,0,0"
IsChecked="{Binding isChecked}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
<Button Content="Test Add New"
Grid.Column="2"
Height="25"
HorizontalAlignment="Left"
Margin="34,2,0,0"
Click="button1_Click" />
<Label Content="{Binding checkedMessageList.Count}"
Grid.Column="2"
Height="25"
Margin="147,2,373,0"
Width="20"
Foreground="white" />
Run Code Online (Sandbox Code Playgroud)
截图:

码:
/* ViewModel Class */
public class MainViewModel : INotifyPropertyChanged
{
// Constructor
public MainViewModel()
{
#region …Run Code Online (Sandbox Code Playgroud) c# wpf observablecollection collectionviewsource icollectionview
我正在按照教程将一个comboBox绑定到一个Enum, 并推出了这个XML代码:
<ComboBox
DisplayMemberPath="Key"
SelectedValuePath="Value"
ItemsSource="{Binding VolumeLevelList}"
SelectedValue="{Binding SelectedVolumeLevel, ValidatesOnDataErrors=True, Mode=TwoWay}"
Height="23" HorizontalAlignment="Left" Margin="189,70,0,0"
VerticalAlignment="Top" Width="120" />
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种方法来选择默认选择,例如
的SelectedIndex = "0"
但那不起作用..
是否可以复制根目录/bucket下的所有文件
示例文件夹结构:
/2016/01/file.json
/2016/02/file.json
/2016/03/file.json
...
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用以下命令:
copy mytable
FROM 's3://mybucket/2016/*'
CREDENTIALS 'aws_access_key_id=<>;aws_secret_access_key=<>'
json 's3://mybucket/jsonpaths.json'
Run Code Online (Sandbox Code Playgroud) 我试图想象如何使用MEF导入通用基类的派生类.这是类的一般描述:
interface IPlugin {}
abstract class PluginBase<T> : IPlugin {}
[Export(typeof(IPlugin))]
class Plugin1 : PluginBase<T1> {
public Plugin1(T1 t1) : base(t1) {};
}
[Export(typeof(IPlugin))]
class Plugin2 : PluginBase<T2> {
public Plugin1(T2 t2) : base(t2) {};
}
[ImportMany(typeof(IPlugin))]
List<IPlugin> importedList { get; set; }
Run Code Online (Sandbox Code Playgroud)
我正在使用以下代码来加载插件:
var aggCatalog = new AggregateCatalog(catalogList);
var container = new CompositionContainer(aggCatalog,
CompositionOptions.DisableSilentRejection);
container.ComposeParts(this);
Run Code Online (Sandbox Code Playgroud)
但我得到一个空列表.