Beispiel #1
0
        private void SetAreaPageLayoutGroup(LocalizeItemSelector localizeItemSelector)
        {
            group = new OdcExpander {
                IsExpanded = true
            };
            group.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            group.Header            = localizeItemSelector.setLocalizeValue(group, OdcExpander.HeaderProperty);
            objTreeView             = new TreeView();

            //objTreeView.PreviewMouseWheel += objTreeView_PreviewMouseWheel;
            KeyboardNavigation.SetTabNavigation(objTreeView, KeyboardNavigationMode.Continue);
            objTreeView.IsTabStop = false;
            KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle);
            group.Content = objTreeView;
        }
Beispiel #2
0
        /// <summary>
        /// Create TreeMenu and TreeMenuItem
        /// </summary>
        /// <param name="GroupName"></param>
        /// <param name="localizeItemSelector"></param>
        /// <param name="item"></param>
        private void SetAreaPageSubItems(string GroupName, LocalizeItemSelector localizeItemSelector, SystemMenuTreeList item)
        {
            Binding binding = new Binding();

            binding.Mode   = BindingMode.TwoWay;
            binding.Source = this;
            binding.Path   = new PropertyPath(Window.LanguageProperty);
            binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            subItemnew = new TreeViewItemEx();
            subItemnew.SetBinding(TreeViewItemEx.LanguageProperty, binding);
            KeyboardNavigation.SetTabNavigation(subItemnew, KeyboardNavigationMode.Continue);
            subItemnew.IsTabStop           = true;
            subItemnew.IsExpanded          = true;
            subItemnew.HorizontalAlignment = HorizontalAlignment.Left;
            subItemnew.Foreground          = Brushes.Black;
            subItemnew.Header = localizeItemSelector.setLocalizeValue(subItemnew, TreeViewItemEx.HeaderProperty);
            _dicTreeViewItemInAreaPage.Add(item.Id, subItemnew);
            subItemnew.IsExpanded = true;
            if (_dicTreeViewItemInAreaPage.ContainsKey(item.PId))
            {
                _dicTreeViewItemInAreaPage[item.PId].Items.Add(subItemnew);
            }
            else
            {
                objTreeView.Items.Add(subItemnew);
            }
            var Col = ItemsSource.OrderBy(a => a.DisplayIndex).Where(p => p.PId == item.Id);

            if (0 < Col.Count())
            {
                GenerateAreaPageGroups(Col, GroupName);
            }
            else
            {
                //subItemnew.PageUri = item.PageUri;
                if (!string.IsNullOrEmpty(item.NameClass))
                {
                    // subItemnew.MouseLeftButtonUp += new MouseButtonEventHandler(newItem_MouseLeftButtonUp);
                    //subItemnew.PreviewKeyDown += new KeyEventHandler(subItemnew_PreviewKeyDown);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Generate BarCrum Tree Items
        /// </summary>
        /// <param name="objlist">TreeItem Collection</param>
        private void GenerateBar(IEnumerable <SystemMenuTreeList> objlist)
        {
            try
            {
                Binding languageBinding = new Binding()
                {
                    Source = this,
                    Mode   = BindingMode.TwoWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                    Path = new PropertyPath(BreadcrumbItem.LanguageProperty)
                };

                LocalizeItemSelector localizeItemSelector;
                foreach (var item in objlist)
                {
                    localizeItemSelector = new LocalizeItemSelector();
                    CommonMethods.AddLocalizeItem(localizeItemSelector, "ja", item.NameJa != null ? item.NameJa : PropertyValueNotSet);
                    CommonMethods.AddLocalizeItem(localizeItemSelector, "en", item.NameEn != null ? item.NameEn : PropertyValueNotSet);
                    CommonMethods.AddLocalizeItem(localizeItemSelector, "th", item.NameTh != null ? item.NameTh : PropertyValueNotSet);
                    CommonMethods.AddLocalizeItem(localizeItemSelector, "zh", item.NameTh != null ? item.NameTh : PropertyValueNotSet);

                    if (item.PId == 0)
                    {
                        withChildBreadcrumbItem         = new BreadcrumbItem();
                        withChildBreadcrumbItem.Header  = localizeItemSelector.setLocalizeValue(withChildBreadcrumbItem, BreadcrumbItem.HeaderProperty);
                        withChildBreadcrumbItem.PageUri = item.PageUri;
                        withChildBreadcrumbItem.SetBinding(BreadcrumbItem.LanguageProperty, languageBinding);
                        this.Items.Add(withChildBreadcrumbItem);

                        var Parents1 = ItemSource.OrderBy(p => p.DisplayIndex).Where(p => p.PId == item.Id);
                        if (Parents1.Any())
                        {
                            GenerateBar(Parents1);
                        }
                    }
                    else
                    {
                        withoutChildBreadcrumbItem         = new BreadcrumbItem();
                        withoutChildBreadcrumbItem.PageUri = item.PageUri;
                        withoutChildBreadcrumbItem.SetBinding(BreadcrumbItem.LanguageProperty, languageBinding);
                        withoutChildBreadcrumbItem.Header = localizeItemSelector.setLocalizeValue(withoutChildBreadcrumbItem, BreadcrumbItem.HeaderProperty);

                        if (!DicBreadCrumbItemAddressBar.ContainsKey(item.Id))
                        {
                            DicBreadCrumbItemAddressBar.Add(item.Id, withoutChildBreadcrumbItem);
                        }
                        if (DicBreadCrumbItemAddressBar.ContainsKey(item.PId))
                        {
                            DicBreadCrumbItemAddressBar[item.PId].Items.Add(withoutChildBreadcrumbItem);
                        }
                        else
                        {
                            withChildBreadcrumbItem.Items.Add(withoutChildBreadcrumbItem);
                        }
                        var Parents = ItemSource.OrderBy(p => p.DisplayIndex).Where(p => p.PId == item.Id);
                        if (Parents.Any())
                        {
                            GenerateBar(Parents);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }