当前位置: 首页>>代码示例>>C#>>正文


C# DatePicker.InvalidateVisual方法代码示例

本文整理汇总了C#中System.Windows.Controls.DatePicker.InvalidateVisual方法的典型用法代码示例。如果您正苦于以下问题:C# DatePicker.InvalidateVisual方法的具体用法?C# DatePicker.InvalidateVisual怎么用?C# DatePicker.InvalidateVisual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.DatePicker的用法示例。


在下文中一共展示了DatePicker.InvalidateVisual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateCaseListCriteriaItem

        public static SearchCaseListCriteriaItem CreateCaseListCriteriaItem(String item, RefreshCaseListHandler refereshList)
        {
            SearchCaseListCriteriaItem critriaItem;
            UIElement element;

            TextBox textbx = new TextBox();
            textbx.Width = 125;
            textbx.Height = 25;
            textbx.TextChanged += new TextChangedEventHandler(refereshList);
            element = textbx;

            switch (item)
            {
                case "CaseID":
                    {
                        break;
                    }
                case "Analyst":
                    {
                        break;
                    }
                case "AnalystComment":
                    {
                        break;
                    }
                case "FlightNumber":
                    {
                        break;
                    }
                case "ObjectID":
                    {
                        break;
                    }
                case "Area":
                    {
                        break;
                    }
                case "Result":
                    {
                        ComboBox cmbBx = new ComboBox();
                        int[] vals = (int[])Enum.GetValues(typeof(WorkstationDecision));
                        String[] ResultList = new String[vals.Length];
                        int i = 0;
                        foreach (int v in vals)
                        {
                            ResultList[i] = v.ToString(CultureResources.getDefaultDisplayCulture());
                            i++;
                        }
                        DataTemplate dataTemplate = new DataTemplate(typeof(String));
                        var binding = new Binding();
                        binding.Converter = new IntToDecisionConverter();
                        var elemFactory = new FrameworkElementFactory(typeof(ContentPresenter));
                        elemFactory.SetBinding(ContentPresenter.ContentProperty, binding);

                        dataTemplate.VisualTree = elemFactory;

                        cmbBx.ItemTemplate = dataTemplate;
                        cmbBx.ItemsSource = ResultList;
                        cmbBx.Height = 25;
                        cmbBx.Width = 125;
                        cmbBx.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
                        cmbBx.SelectionChanged += new SelectionChangedEventHandler(refereshList);


                        CultureResources.getDataProvider().DataChanged += new EventHandler((object sender, EventArgs e) =>
                        {
                            // reset the items source to refresh the display
                            int index = cmbBx.SelectedIndex;
                            var source = cmbBx.ItemsSource;
                            cmbBx.ItemsSource = null;
                            cmbBx.ItemsSource = source;
                            cmbBx.SelectedIndex = index;
                        });

                        element = cmbBx;
                        break;
                    }
                case "UpdateTime":
                    {
                        StackPanel panel = new StackPanel();

                        DatePicker datePicker = new DatePicker();
                        datePicker.IsTodayHighlighted = true;
                        datePicker.SelectedDate = DateTime.Now.AddDays(-7);
                        datePicker.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(refereshList);
                        panel.Children.Add(datePicker);

                        datePicker = new DatePicker();
                        datePicker.IsTodayHighlighted = true;
                        datePicker.SelectedDate = DateTime.Now;
                        datePicker.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(refereshList);

                        // catch culture changes and refresh the date picker
                        CultureResources.getDataProvider().DataChanged += new EventHandler((object sender, EventArgs e) =>
                        {   
                            datePicker.InvalidateVisual();
                        });

                        panel.Children.Add(datePicker);

//.........这里部分代码省略.........
开发者ID:BdGL3,项目名称:CXPortal,代码行数:101,代码来源:CaseListSearch.cs


注:本文中的System.Windows.Controls.DatePicker.InvalidateVisual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。