如何从StackPanel WPF上以编程方式添加UC获取价值

时间:2016-04-19 15:06:31

标签: c# wpf xaml user-controls

这是我的 UC

 public partial class ChartDialogView : UserControl
    {
      public long Value
        {
         get
           {
              return TextBox1.Content;
           }
        }
        public ChartDialogView()
        {
            InitializeComponent();
        }
    }

在主表单上,我添加了一些 UC 项目

ChartDialogView uc = new ChartDialogView();
            ChartList.Children.Add(uc);

所以问题是如何获得第二个(例如)添加项的价值? 这是我的XAML(也许有帮助)

            <ScrollViewer Margin="44,40,0,11"
                          HorizontalAlignment="Left"
                          HorizontalScrollBarVisibility="Hidden"
                          VerticalScrollBarVisibility="Hidden"
                          Width="257"
                          Foreground="{x:Null}">
                <StackPanel x:Name="ChartList">
                    <StackPanel.ScrollOwner>
                        <ScrollViewer CanContentScroll="True" />
                    </StackPanel.ScrollOwner>
                </StackPanel>
            </ScrollViewer>

All of that look like here

1 个答案:

答案 0 :(得分:0)

所以我找到了方法,如果有人需要

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.impl.context.Context;
import org.springframework.stereotype.Component;

@Component("customService")
public class CustomService {

    public void executeExpression(String expression, DelegateExecution execution) {
        Context.getProcessEngineConfiguration().getExpressionManager()
            .createExpression(expression).getValue(execution);
}