/// <summary>
 /// 初始化分类下拉框
 /// </summary>
 private void InitSortCmb(string kind = CommConst.IncomeCd)
 {
     cmbSort.ItemsSource       = service.GetSorts().Where(x => x.SortCd.StartsWith(kind)).OrderBy(x => x.SortCd);
     cmbSort.SelectedValuePath = "SortCd";
     cmbSort.DisplayMemberPath = "SortName";
     cmbSort.SelectedIndex     = 0;
 }
Esempio n. 2
0
        public EditSorts(string sortCd, string kind)
        {
            InitializeComponent();

            this.kind = kind;

            // 不显示在任务栏
            this.ShowInTaskbar = false;

            // 背景初始化
            ImageBrush imageBrush = new ImageBrush();

            imageBrush.Stretch        = Stretch.UniformToFill;
            imageBrush.ImageSource    = ReadPicture(@"Resource\BackgroudImage\main.jpg");
            this.editBrush.Background = imageBrush;
            // 初始化下拉菜单
            cmbSort.ItemsSource       = service.GetSorts().Where(x => x.SortCd.StartsWith(kind));
            cmbSort.SelectedValuePath = "SortCd";
            cmbSort.DisplayMemberPath = "SortName";
            cmbSort.SelectedValue     = sortCd;

            // 将此前选中的分类名设置到文本框上
            this.cmbSort_SelectionChanged(null, null);
        }