Пример #1
0
        public override void SetToolTip()
        {
            wLabel   L = DataGrid.Sets[0].Points[0].ToolTip;
            wGraphic G = L.Graphics;
            wFont    F = G.FontObject;

            DefaultTooltip Tip = (DefaultTooltip)Element.DataTooltip;

            Tip.SelectionMode = TooltipSelectionMode.OnlySender;

            if (L.Enabled)
            {
                Tip.BulletSize = 0;

                Tip.ShowSeries = false;
                Tip.Background = G.GetBackgroundBrush();
                Tip.Foreground = F.GetFontBrush();

                Tip.BorderBrush     = G.GetStrokeBrush();
                Tip.BorderThickness = G.GetStroke();

                Tip.FontFamily = F.ToMediaFont().Family;
                Tip.FontSize   = F.Size;
                Tip.FontStyle  = F.ToMediaFont().Italic;
                Tip.FontWeight = F.ToMediaFont().Bold;
            }

            Element.DataTooltip = Tip;
        }
Пример #2
0
        public void SetProperties(DataSetCollection WindDataCollection, bool HasTitles)
        {
            Element.Children.Clear();
            Element.RowDefinitions.Clear();
            Element.ColumnDefinitions.Clear();

            Wc = WindDataCollection;

            for (int i = 0; i < Wc.Sets.Count; i++)
            {
                if (Wc.Sets[i].Title == "")
                {
                    Wc.Sets[i].Title = ("Title " + i.ToString());
                }

                ColumnDefinition col = new ColumnDefinition();
                Element.ColumnDefinitions.Add(col);
            }

            int k = 0;

            if (HasTitles)
            {
                k = 1;

                RowDefinition TitleRow = new RowDefinition();
                Element.RowDefinitions.Add(TitleRow);

                for (int i = 0; i < Wc.Sets.Count; i++)
                {
                    wGraphic G = Wc.Graphics;

                    Label ttxt = new Label();
                    ttxt.Content         = Wc.Sets[i].Title;
                    ttxt.Background      = G.GetBackgroundBrush();
                    ttxt.Foreground      = G.FontObject.GetFontBrush();
                    ttxt.BorderBrush     = G.GetStrokeBrush();
                    ttxt.BorderThickness = G.GetStroke();

                    ttxt.Padding = G.GetPadding();
                    ttxt.Margin  = G.GetMargin();

                    ttxt.FontFamily = G.FontObject.ToMediaFont().Family;
                    ttxt.FontSize   = G.FontObject.Size;
                    ttxt.FontStyle  = G.FontObject.ToMediaFont().Italic;
                    ttxt.FontWeight = G.FontObject.ToMediaFont().Bold;
                    ttxt.HorizontalContentAlignment = G.FontObject.ToMediaFont().HAlign;
                    ttxt.VerticalContentAlignment   = G.FontObject.ToMediaFont().VAlign;

                    Grid.SetColumn(ttxt, i);
                    Grid.SetRow(ttxt, 0);
                    Element.Children.Add(ttxt);
                }
            }

            for (int i = 0; i < Wc.Sets[0].Points.Count; i++)
            {
                RowDefinition row = new RowDefinition();
                Element.RowDefinitions.Add(row);
                for (int j = 0; j < (Wc.Count); j++)
                {
                    DataPt   Pt = Wc.Sets[j].Points[i];
                    wGraphic G  = Pt.Graphics;
                    wFont    F  = G.FontObject;

                    Border brd = new Border();
                    Label  txt = new Label();
                    txt.Content = string.Format("{0:" + Pt.Label.Format + "}", Pt.Number);

                    txt.Background      = Brushes.Transparent;
                    txt.Foreground      = G.GetFontBrush();
                    txt.BorderBrush     = Brushes.Transparent;
                    txt.BorderThickness = new Thickness(0);

                    txt.Padding = G.GetPadding();
                    txt.Margin  = G.GetMargin();

                    txt.FontFamily = F.ToMediaFont().Family;
                    txt.FontSize   = F.Size;
                    txt.FontStyle  = G.FontObject.ToMediaFont().Italic;
                    txt.FontWeight = G.FontObject.ToMediaFont().Bold;
                    txt.HorizontalContentAlignment = F.ToMediaFont().HAlign;
                    txt.VerticalContentAlignment   = F.ToMediaFont().VAlign;

                    if (G.Width > 1)
                    {
                        txt.Width = G.Width;
                    }
                    else
                    {
                        txt.Width = double.NaN;
                    }
                    if (G.Height > 1)
                    {
                        txt.Height = G.Height;
                    }
                    else
                    {
                        txt.Height = double.NaN;
                    }


                    brd.CornerRadius    = G.GetCorner();
                    brd.Background      = G.GetBackgroundBrush();
                    brd.BorderBrush     = G.GetStrokeBrush();
                    brd.BorderThickness = G.GetStroke();

                    brd.Child = txt;

                    Grid.SetColumn(brd, j);
                    Grid.SetRow(brd, i + k);
                    Element.Children.Add(brd);
                }
            }
        }