using Kingo.PluginServiceInterface; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows.Controls; namespace Kingo.Plugin.SystemSetting.View.ViewSystemSetting { /// /// ViewLayterAttributeSetting.xaml 的交互逻辑 /// public partial class ViewLayterAttributeSetting : UserControl { public ViewLayterAttributeSetting() { InitializeComponent(); lbTBList.SelectedIndex = 0; this.Loaded += (s, e) => { lbTBList.ItemsSource = (lbTBList.ItemsSource as List).FindAll(x => x.FieldsCfg.Count > 0); }; } private void LbTBList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lbTBList.SelectedItem is LayerCfg) { if ((lbTBList.SelectedItem as LayerCfg).FieldsCfg.Count == 0) lbTBList.SelectedItem = (lbTBList.ItemsSource as List).FirstOrDefault(x => x.FieldsCfg.Count > 0); treeList.ItemsSource = null; treeList.ItemsSource = (lbTBList.SelectedItem as LayerCfg).GetAllFields(); } else { return; } } } }