{ get; set; } public string SelectedItem { get; set; } ListBoxItems = new ObservableCollection <string>() { }; ListBoxItems.Add("ShellView"); ListBoxItems.Add("EventAggregatorView "); ListBoxItems.Add("ConductorView"); ListBoxItems.Add("MatchTemplateView"); ListBoxItems.Add("IndicatorLightView"); ListBoxItems.Add("MemorandumView"); ListBoxItems.Add("FTPTestView"); ②listbox选择改变后切换页面: public void ListBoxItems_SelectionChanged
<Button x:Name="testBtn" Content="testBtn" Background="LightCyan"/> <ListBox Name="<em>ListBoxItems</em> ($source,$eventArgs)]; [Event MouseUp]=[<em>ListBoxItems</em>_MouseUp($source = new ObservableCollection<string>() { }; <em>ListBoxItems</em>.Add("愚公一号"); ListBoxItems.Add ("愚公二号"); ListBoxItems.Add("愚公三号"); } public ObservableCollection<string> ListBoxItems ; NotifyOfPropertyChange(()=> TextContent); } public void ListBoxItems_MouseUp(object
($source,$eventArgs)]; [Event MouseUp]=[ListBoxItems_MouseUp($source = new ObservableCollection<string>() { }; ListBoxItems.Add("dotNet编程大全"); ListBoxItems.Add ("Csharp编程大全"); ListBoxItems.Add("dotnet工控上位机编程"); } public ObservableCollection <string> ListBoxItems { get; set; } public string TextContent { get; set; } public void ; NotifyOfPropertyChange(()=> TextContent); } public void ListBoxItems_MouseUp
= new ObservableCollection<string>() { }; ListBoxItems.Add("ShellView"); ListBoxItems.Add ("EventAggregatorView"); ListBoxItems.Add("ConductorView"); logger.Info($"Leave [MainWindowViewModel]."); } public void ListBoxItems_SelectionChanged() { ()是listbox的选择改变事件: <ListBox Name="<em>ListBoxItems</em>" Grid.Column="0" SelectedItem="{Binding SelectedItem}" Margin="2" cal:Message.Attach="[Event SelectionChanged] = [Action <em>ListBoxItems</em>_SelectionChanged]"/>