我无法清除ListBox.SelectedItems集合.请说明我做错了什么.我以不同的方式清除收藏,但它留下以前的收藏.
我清楚收集所以:
chListBox.SelectedItems.Clear();
Run Code Online (Sandbox Code Playgroud)
要么
chListBox.UnselectAll();
Run Code Online (Sandbox Code Playgroud)
要么
chListBox.SetSelectedItems(new ArrayList());
Run Code Online (Sandbox Code Playgroud)
我的代码:
public class CheckListBox : ListBox
{
public CheckListBox()
{
this.SelectionChanged += CheckListBox_SelectionChanged;
this.Resources = Application.LoadComponent(new Uri("/TASWpfControls;component/Resources/CheckListBoxResources.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary;
this.ItemContainerStyle = this.Resources["CheckListBoxItem"] as Style;
this.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ClickEventHandler));
}
private void ClickEventHandler(object sender, RoutedEventArgs routedEventArgs)
{
RoutedEventArgs eventArgs = new RoutedEventArgs(ItemSelectedEvent);
this.RaiseEvent(eventArgs);
}
public string PropertyName { get; set; }
public string PropertyCompare { get; set; }
public static readonly DependencyProperty SelectedSourceProperty =
DependencyProperty.Register("SelectedSource", typeof(IList), typeof(CheckListBox), new PropertyMetadata(SelectedSourceChanged));
public IList SelectedSource
{ …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 KafkaTool 连接到 Kafka。我收到一个错误:连接到集群时出错。未能创建新的 KafkaAdminClient
Kafka 和 Zookeeper 托管在 Docker 中。我运行下一个命令
docker network create kafka
docker run --network=kafka -d --name zookeeper -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:latest
docker run --network=kafka -d -p 9092:9092 --name kafka -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 confluentinc/cp-kafka:latest
Run Code Online (Sandbox Code Playgroud)
为什么 KafkaTool 无法连接到托管在 Docker 中的 Kafka?