Example #1
0
        private void AddBarcodeToDesign_Click(object sender, MouseButtonEventArgs e)
        {
            var textblock = new BindableTextBlock(BindableTextType.BarCode)
            {
                Designing = true,
                Height    = 30
            };

            DESIGN_Canvas.Children.Add(textblock);
            Canvas.SetLeft(textblock, 10);
            Canvas.SetTop(textblock, 10);
        }
Example #2
0
        private void AddTextBlockToDesign(object sender, MouseButtonEventArgs e)
        {
            var textblock = new BindableTextBlock(BindableTextType.Normal)
            {
                Designing = true,
                Height    = 50
            };

            DESIGN_Canvas.Children.Add(textblock);
            Canvas.SetLeft(textblock, 10);
            Canvas.SetTop(textblock, 10);
        }
Example #3
0
        public void LoadSavedDesign()
        {
            /// TODO: Defined XAML for this designer is as same as the one in
            /// <see cref="Dashboard.UI.Assets.PrintAssets.PrintResource"/>. Make them a
            /// Single one to handle it better. See Bookmarks with tag #XAML_DESIGN_DUP for more info

            var  conf           = App.CurrentApp.AppConfiguration.DesignModel;
            bool isDefaultImage = string.IsNullOrEmpty(conf.ImageBackgroundSource);
            var  imgUri         = isDefaultImage ?
                                  "pack://application:,,,/Dashboard;component/Resources/Images/ReportDefault - NO.png" : conf.ImageBackgroundSource;
            var image  = new BitmapImage(new Uri(imgUri));
            var height = image.Height;
            var width  = image.Width;

            DESIGN_FixedPage.Width  = DESIGN_Image.Width = DESIGN_Canvas.Width = width;
            DESIGN_FixedPage.Height = DESIGN_Image.Height = DESIGN_Canvas.Height = height;

            DESIGN_Image.Source = image;
            dragDropHandler     = new BasicDesignControlDragDropHandler(DESIGN_Canvas)
            {
                ConstraintToBounds = true,
                ConstraintArea     = new Point(DESIGN_Image.Width, DESIGN_Image.Height)
            };

            foreach (var item in conf.Textboxes)
            {
                var textblock = new BindableTextBlock(item.Type)
                {
                    Width          = item.Width,
                    Height         = item.Height,
                    Tag            = (item.IsBound) ? $"BINDTO:{item.BindingTag}" : "",
                    Text           = item.Text,
                    TextFontWeight = item.Type == BindableTextType.Normal ? FontWeights.Bold : FontWeights.Normal,
                    Designing      = true
                };
                if (item.IsBound)
                {
                    SetBinding(BindableTextBlock.TextProperty, item.BindingTag);
                }
                DESIGN_Canvas.Children.Add(textblock);
                Canvas.SetLeft(textblock, item.CanvasLeft);
                Canvas.SetTop(textblock, item.CanvasTop);
            }

            if (isDefaultImage)
            {
                Slider.Value = 60;
            }
        }
Example #4
0
        public override bool TryCreateDetailsContent(out FrameworkElement expandedContent)
        {
            if (this.TryGetValue(FullTextInlinesColumnName, out object content) &&
                content is List <Inline> inlines &&
                inlines?.Any() == true)
            {
                expandedContent = new BindableTextBlock()
                {
                    TextWrapping = TextWrapping.Wrap,
                    InlineList   = new ObservableCollection <Inline>(inlines),
                };
                return(true);
            }

            return(base.TryCreateDetailsContent(out expandedContent));
        }
        private static void LoadDesign(FixedPage DESIGN_FixedPage, Canvas DESIGN_Canvas, Image DESIGN_Image)
        {
            var  conf           = App.CurrentApp.AppConfiguration.DesignModel;
            bool isDefaultImage = string.IsNullOrEmpty(conf.ImageBackgroundSource) || conf.ImageBackgroundSource == "pack://application:,,,/Dashboard;component/Resources/Images/ReportDefault - NO.png";
            var  imgUri         = isDefaultImage ?
                                  "pack://application:,,,/Dashboard;component/Resources/Images/ReportDefault - NO.png" : conf.ImageBackgroundSource;
            var image  = new BitmapImage(new Uri(imgUri));
            var height = image.Height;
            var width  = image.Width;

            DESIGN_FixedPage.Width  = DESIGN_Image.Width = DESIGN_Canvas.Width = width;
            DESIGN_FixedPage.Height = DESIGN_Image.Height = DESIGN_Canvas.Height = height;

            DESIGN_Image.Source = image;

            foreach (var item in conf.Textboxes)
            {
                var textblock = new BindableTextBlock(item.Type, disableContextMenu: true)
                {
                    Width          = item.Width,
                    Height         = item.Height,
                    Tag            = (item.IsBound) ? $"BINDTO:{item.BindingTag}" : "",
                    Designing      = false,
                    FontSize       = 20,
                    TextFontWeight = item.Type == BindableTextType.Normal ? FontWeights.Bold : FontWeights.Normal,
                    FontFamily     = (item.Type == BindableTextType.Normal) ? new FontFamily("Times New Roman")  : DocumentHelper.BarcodeFont
                };
                if (item.IsBound)
                {
                    textblock.SetBinding(BindableTextBlock.TextProperty, item.BindingTag);
                }
                else if (item.Type == BindableTextType.BarCode)
                {
                    textblock.SetBinding(BindableTextBlock.TextProperty, "BarCodeUI");
                }
                else
                {
                    textblock.Text = item.Text;
                }
                DESIGN_Canvas.Children.Add(textblock);
                Canvas.SetLeft(textblock, item.CanvasLeft);
                Canvas.SetTop(textblock, item.CanvasTop);
            }
        }