Exemplo n.º 1
0
        private void DataSourceSettingButton_Click(object sender, RoutedEventArgs e)
        {
            string key = (((sender as Button).Parent as StackPanel).FindName("DataSourceTB") as TextBox).Text;
            DataSourceSettingWindow win = new DataSourceSettingWindow(key);

            if (win.ShowDialog() == true)
            {
                //更改Key,并通过管理器获取对象添加至数据源集合
                key = win.SelectedItem.Name;

                ((((sender as Button).Parent as StackPanel).FindName("DataSourceTB") as TextBox).DataContext as PropertyGridPropertyItem).Value = key;
                this.CurrentDesignerPage.Board.AddBackControl(DataSourceManager.GetDataSource(key));
            }
        }
        private void DesignDataSource_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            string key = null;

            if (this.SelectItem is DesignerChart)
            {
            }
            else if (this.SelectItem is IDynamicData)
            {
                key = (this.SelectItem as IDynamicData).DataSourceKey;
            }

            DataSourceSettingWindow win = new DataSourceSettingWindow(key);

            if (win.ShowDialog() == true)
            {
                //更改Key,并通过管理器获取对象添加至数据源集合
                key = win.SelectedItem.Name;
                (this.SelectItem as IDynamicData).DataSourceKey = key;
                this.Board.AddBackControl(DataSourceManager.GetDataSource(key));
            }
        }