示例#1
0
        public static void ItemBackgroundColourPropertyChanged(object source, DependencyPropertyChangedEventArgs e)
        {
            GnosisGalleryItem galleryItem = source as GnosisGalleryItem;

            //string backgroundColour = (string)e.NewValue;

            galleryItem.btnCaption.Background = (Brush)e.NewValue;// StyleHelper.GetBrushFromHex(backgroundColour);
        }
示例#2
0
        public void AddGalleryItem(GnosisGalleryItem child)
        {
            //if (horizontalSpacing > 0)
            //{
            //    if (Items.Count == 0)
            //    {
            //        child.Margin = new Thickness()
            //    }
            //    child.Margin = new Thickness(verticalMargin, horizontalMargin, verticalMargin, horizontalMargin + horizontalSpacing);

            //}
            // child.PropertyChanged += Child_PropertyChanged;
            pnlItems.Children.Add(child);
            toggle.Visibility = Visibility.Visible;
        }
示例#3
0
        public static void ControlThicknessPropertyChanged(object source, DependencyPropertyChangedEventArgs e)
        {
            GnosisGalleryItem galleryItem = source as GnosisGalleryItem;
            int newThickness = (int)e.NewValue;
            int oldThickness = (int)e.OldValue;

            //if in wide format, thickness is taken from margin
            //else thickness is taken from padding


            if (galleryItem.IsWideFormat)
            {
                double marginHorizontal;
                double marginVertical;

                if (newThickness > oldThickness)
                {
                    //increase border thickness, decrease margin, increase height
                    marginHorizontal = galleryItem.HorizontalMargin - newThickness;
                    marginVertical   = galleryItem.VerticalMargin - newThickness;

                    //double fieldHeight = GlobalData.Singleton.StyleHelper.GetFieldHeight(galleryItem, galleryItem.FontFamily.ToString(), (int)galleryItem.FontSize);
                    //if (marginVertical >= 0 && marginHorizontal >= 0)
                    //{
                    //    galleryItem.Height = galleryItem.Height + (newThickness - oldThickness);
                    //}
                }
                else
                {
                    //decrease border thickness, increase margin, decrease height
                    marginHorizontal = galleryItem.Margin.Left + oldThickness;
                    marginVertical   = galleryItem.Margin.Top + oldThickness;
                    // galleryItem.Height = galleryItem.Height - (oldThickness - newThickness);
                }

                if (marginHorizontal >= 0 && marginVertical >= 0)
                {
                    if (galleryItem.GnosisParent is GnosisGallery)
                    {
                        galleryItem.btnCaption.Margin = new Thickness(marginHorizontal, marginVertical, marginHorizontal, marginVertical);
                    }
                    else
                    {
                        galleryItem.btnCaption.Margin = new Thickness(marginHorizontal, marginVertical + galleryItem.VerticalSpacing,
                                                                      marginHorizontal, marginVertical);
                    }

                    galleryItem.btnCaption.BorderThickness = new Thickness(newThickness);
                }
            }
            else
            {
                double paddingHorizontal;
                double paddingVertical;

                if (newThickness > galleryItem.btnCaption.BorderThickness.Left)
                {
                    //increase border thickness, decrease padding
                    paddingHorizontal = galleryItem.HorizontalPadding - newThickness;
                    paddingVertical   = galleryItem.VerticalPadding - newThickness;
                }
                else
                {
                    //decrease border thickness, increase padding
                    paddingHorizontal = galleryItem.HorizontalPadding + oldThickness;
                    paddingVertical   = galleryItem.VerticalPadding + oldThickness;
                }

                if (paddingHorizontal >= 0 && paddingVertical >= 0)
                {
                    galleryItem.btnCaption.Padding         = new Thickness(paddingHorizontal, paddingVertical, paddingHorizontal, paddingVertical);
                    galleryItem.btnCaption.BorderThickness = new Thickness(newThickness);
                }
            }
        }
示例#4
0
        //private void GnosisGallery_PropertyChanged(object sender, PropertyChangedEventArgs e)
        //{
        //    switch (e.PropertyName)
        //    {
        //        case "Caption":
        //            break;
        //        case "Hidden":
        //            this.SetVisibleExt(!hidden);
        //            break;
        //        case "Tooltip":
        //            this.ToolTip = tooltip;
        //            break;
        //    }
        //}

        private void AddGalleryItem(GnosisGalleryItem item)
        {
            //  item.Margin = new Thickness(item.Margin.Left, item.Margin.Top, item.Margin.Right, horizontalSpacing);
            content.Children.Add(item);
        }