public class SyslogList : SuperViewModel {
private string _message;
private string _timestamp;
+ private bool _isSelected;
public string message {
get { return _message; }
set { SetProperty(ref _timestamp, value); }
}
+ public bool IsSelected
+ {
+ get { return _isSelected; }
+ set { SetProperty(ref _isSelected, value); }
+ }
+
public override string ToString () {
return string.Concat(timestamp, ": ", message);
}
private DelegateCommand _clearCommand;
private string _searchText;
- private SyslogList _selectedItem;
+ private SyslogList _selectedItems;
private List<SyslogList> _syslogList;
private List<SyslogList> _filteredList;
}
}
- public SyslogList SelectedItem {
- get { return _selectedItem; }
- set { SetProperty(ref _selectedItem, value); }
+ public SyslogList SelectedItems
+ {
+ get { return _selectedItems; }
+ set { SetProperty(ref _selectedItems, value); }
}
public List<SyslogList> syslogList {
new Thread(() => { SpeedportHybrid.initSyslog(); }).Start();
}
+ public IEnumerable<SyslogList> SelectedItens
+ {
+ get { return filteredList.Where(o => o.IsSelected); }
+ }
+
private void OnCopyCommandExecute () {
- Clipboard.SetText(SelectedItem.ToString());
+ string text = string.Empty;
+ foreach (SyslogList item in SelectedItens) {
+ text = string.Concat(text, Environment.NewLine, item.ToString());
+ }
+
+ Clipboard.SetText(text);
}
private void OnClearCommandExecute () {
<TextBlock HorizontalAlignment="Right" Margin="0,0,124,0" Text="Suche:" VerticalAlignment="Top"/>
<TextBox x:Name="tbSearch" HorizontalAlignment="Right" VerticalAlignment="Top" Width="120" Text="{Binding Path=SearchText, UpdateSourceTrigger=PropertyChanged}"/>
- <ListView ItemsSource="{Binding filteredList}" SelectedItem="{Binding Path=SelectedItem, UpdateSourceTrigger=PropertyChanged}" x:Name="listView" Margin="0,23,0,39">
+ <ListView ItemsSource="{Binding filteredList}" SelectedItem="{Binding Path=SelectedItems, UpdateSourceTrigger=PropertyChanged}" x:Name="listView" Margin="0,23,0,39">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="{x:Type ListBoxItem}">
+ <Setter Property="IsSelected" Value="{Binding Mode=TwoWay, Path=IsSelected}"/>
+ </Style>
+ </ListBox.ItemContainerStyle>
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="Copy" Command="{Binding Path=CopyCommand, NotifyOnTargetUpdated=True}"/>