Пример #1
0
        void popup_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
        {
            if (!subsequentCall)
            {
                if (DropDownContent != null)
                {
                    if (DropDownContent.GetType().GetProperty("ActiveSmartPart") != null)
                    {
                        object smartPart = DropDownContent.GetType().GetProperty("ActiveSmartPart").GetValue(DropDownContent, null);
                        if (smartPart != null)
                        {
                            subsequentCall = true;

                            if (smartPart is UserControl)
                            {
                                if (((UserControl)smartPart).Content != null)
                                {
                                    object content = ((UserControl)smartPart).Content;

                                    if (content != null && content is Grid)
                                    {
                                        Grid grid = (Grid)content;

                                        if (grid.RowDefinitions.Count == 2)
                                        {
                                            RowDefinition rowDef = grid.RowDefinitions[0];

                                            if (rowDef.ActualHeight > (popup.Height / 3))
                                            {
                                                popup.Height = rowDef.ActualHeight + 200;
                                                double newWidth = (rowDef.ActualHeight + 200) * 1.618;
                                                if (newWidth > popup.Width)
                                                {
                                                    popup.Width = newWidth;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ToggleButton dropDownButton = Template.FindName("PART_DropDownButton", this) as ToggleButton;

            popup = Template.FindName("PART_Popup", this) as Popup;

            if (!IsEditable)
            {
                this.IsReadOnly = true;
            }

            DropDownContent.SetValue(TextBoxBase.IsReadOnlyProperty, false);

            popup.Opened += (s, e) =>
            {
                DropDownContent.Focus();
            };

            popup.RequestBringIntoView += new RequestBringIntoViewEventHandler(popup_RequestBringIntoView);

            if (dropDownButton != null)
            {
                dropDownButton.Click += (s, e) =>
                {
                    e.Handled = true;
                    RaiseEvent(new RoutedEventArgs(DialogButtonClickEvent, this));
                };
            }

            Thumb thumb = Template.FindName("PART_ResizeGrip", this) as Thumb;

            if (thumb != null)
            {
                thumb.DragDelta += DragDeltaEventHandler;
            }

            dropDownContentHost = Template.FindName("PART_DropDownContentHost", this) as ContentPresenter;

            if (dropDownContentHost != null)
            {
                dropDownContentHost.Content = DropDownContent;
            }
        }
Пример #3
0
 public JsonResult GetDepartmentsWithDef()
 {
     return(Json(DropDownContent.GetDropDownDepart()));
 }
Пример #4
0
        public async Task <ActionResult> Index()
        {
            ViewBag.CityList = await DropDownContent.GetCityStringAsync();

            return(View());
        }