Exemplo n.º 1
0
        public KnowledgeWiki()
        {
            InitializeComponent();
            viewModel   = new KnowledgeWikiViewModel();
            DataContext = viewModel;

            foreach (var knowledge in viewModel.Knowledges)
            {
                Button button = new Button();
                button.Content = $" {knowledge.Knowledge} ";
                //button.Width = 160;
                button.Height = 40;
                button.Margin = new Thickness(10, 5, 10, 5);
                button.Name   = "btn" + knowledge.Id.Replace("-", "");
                button.Tag    = knowledge;
                Binding binding = new Binding()
                {
                    Source = knowledge,
                    Path   = new PropertyPath("Visibility"),
                    Mode   = BindingMode.TwoWay,
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                };
                BindingOperations.SetBinding(button, Button.VisibilityProperty, binding);
                ButtonHelper.SetButtonStyle(button, ButtonStyle.Hollow);
                ButtonHelper.SetClickStyle(button, ClickStyle.Sink);
                ButtonHelper.SetCornerRadius(button, new CornerRadius(4));
                ButtonHelper.SetHoverBrush(button, "#00BCFF".ToColor().ToBrush());
                button.BorderBrush = "#20A0FF".ToColor().ToBrush();
                button.Foreground  = "#20A0FF".ToColor().ToBrush();
                button.Click      += Button_Click;
                this.content.Children.Add(button);
            }
        }
Exemplo n.º 2
0
        private void UpdateTemplate()
        {
            var color = Helper.GetColorByOffset(_linearGradientBrush.GradientStops, SldTheme.Value / 7);

            ButtonHelper.SetCornerRadius(BtnCustom, new CornerRadius(SldCornerRadius.Value));
            BtnCustom.Width = SldWidth.Value;

            if (BtnCustom.Width < 60)
            {
                BtnCustom.Content = "";
                ButtonHelper.SetWaitingContent(BtnCustom, null);
            }
            else
            {
                BtnCustom.Content = " Button";
                ButtonHelper.SetWaitingContent(BtnCustom, "Please wait...");
            }


            switch (ButtonHelper.GetButtonStyle(BtnCustom))
            {
            case ButtonStyle.Standard:
                BtnCustom.Foreground = Colors.White.ToBrush();
                BtnCustom.Background = new Color()
                {
                    A = 200, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;

            case ButtonStyle.Hollow:
                BtnCustom.Background  = Colors.Transparent.ToBrush();
                BtnCustom.Foreground  = color.ToBrush();
                BtnCustom.BorderBrush = color.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;

            case ButtonStyle.Outline:
                BtnCustom.Background = Colors.Transparent.ToBrush();
                BtnCustom.Foreground = new Color()
                {
                    A = 150, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                BtnCustom.BorderBrush = new Color()
                {
                    A = 150, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;

            case ButtonStyle.Link:
                BtnCustom.Background = Colors.Transparent.ToBrush();
                BtnCustom.Foreground = new Color()
                {
                    A = 150, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;
            }
        }
Exemplo n.º 3
0
        public SSMessageBox()
        {
            InitializeComponent();

            SSMessageHelper.buttonOK = false;
            SSMessageHelper.buttonNO = false;

            BG.BeginInit();
            BG.Source = baseColora.Bgpa;
            BG.EndInit();
            this.Background   = baseColora.Tran;
            Border.Background = baseColora.DBg;
            WindowXCaption.SetHeight(this, 0);

            this.ICON.Foreground = baseColora.Fg;
            ButtonHelper.SetHoverBrush(ICON, baseColora.Fg);
            ButtonHelper.SetIcon(ICON, ButtonHelper.GetIcon(SSMessageHelper.Icon));
            this.OK.Content    = SSMessageHelper.bOKtext;
            this.OK.Foreground = baseColora.Fg;
            this.OK.Background = baseColora.Bg;
            ButtonHelper.SetHoverBrush(OK, baseColora.Main);
            ButtonHelper.SetCornerRadius(OK, new CornerRadius(3, 3, 3, 3));
            this.CANC.Content    = SSMessageHelper.bNOtext;
            this.CANC.Foreground = baseColora.Fg;
            this.CANC.Background = baseColora.Bg;
            ButtonHelper.SetHoverBrush(CANC, baseColora.Main);
            ButtonHelper.SetCornerRadius(CANC, new CornerRadius(3, 3, 3, 3));

            this.TITLE.Text       = SSMessageHelper.Title;
            this.TITLE.Foreground = baseColora.Fg;
            this.TITLE.Background = baseColora.Tran;
            this.TITLE.FontFamily = baseColora.Fonts;
            this.TITLE.FontSize   = 25;

            this.SAY.Text       = "       " + SSMessageHelper.Says;
            this.SAY.Foreground = baseColora.Fg;
            this.SAY.Background = baseColora.Tran;
            this.SAY.FontFamily = baseColora.Fonts;
            this.SAY.FontSize   = 16;

            if (SSMessageHelper.noNo)
            {
                this.CANC.Visibility = Visibility.Collapsed;
            }
        }