Theme not being applied to show dialog

2 posts, 0 answers
  1. David
    David avatar
    77 posts
    Member since:
    Nov 2011

    Posted 19 Mar 2019 Link to this post

    Hi For some reason the theme fluent dark is not being applied to a show dialog function. I have included the designer file and the main form code below for your to check but all other forms are working fine which is weird.

    Main Form Code.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Telerik.WinControls;
    using FuelActivityTrackerDapperDal;
    using FuelActivityTrackerDapperDal.Models;
    using FuelActivityTrackerDesktop.Forms;
    using System.Linq;
     
    namespace FuelActivityTrackerDesktop.Forms
    {
        
        public partial class Login : Telerik.WinControls.UI.RadForm
        {
            ActivityTrackerDapperDal db = new ActivityTrackerDapperDal();
            public IEnumerable<Users> _users { get; set; }
            public Login()
            {
                InitializeComponent();
                
            }
     
            private void Login_Load(object sender, EventArgs e)
            
                _users = db.GetALLUsers();
     
                ThemeResolutionService.ApplyThemeToControlTree(this, "FluentDark");
     
            }
     
            private void btnLogin_Click(object sender, EventArgs e)
            {
                if(txtUsername.Text == "")
                {
     
                    MessageBox.Show("Please enter your login details", "Fuel");
                    
     
                }
     
     
     
                Users _user = _users.Where(w => w.UserName.ToLower() == txtUsername.Text.Trim().ToLower() && w.Password.ToLower() == txtPassword.Text.Trim().ToLower()).FirstOrDefault();
                LoggedIn.UserName = _user.UserName;
                LoggedIn.UserId = _user.id;
                LoggedIn.StaffId = _user.StaffId;
                if (_user.isActive == true)
                {
                    frmMain _frmmain = new frmMain();
                    this.Hide();
                    _frmmain.ShowDialog();
     
                }
                else
                    MessageBox.Show("Your account has been made inactive , Please check with Administrator", "Fuel");
     
                DialogResult = DialogResult.OK;
             
            }
     
            private void txtPassword_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                    btnLogin_Click(sender, e);
            }
        }
    }

     

     

    Designer file of the form.

    namespace FuelActivityTrackerDesktop.Forms
    {
        partial class Login
        {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
     
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
     
            #region Windows Form Designer generated code
     
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Login));
                this.imagePanel = new System.Windows.Forms.Panel();
                this.logoPictureBox = new System.Windows.Forms.PictureBox();
                this.radPanel1 = new Telerik.WinControls.UI.RadPanel();
                this.radLabel3 = new Telerik.WinControls.UI.RadLabel();
                this.radLabel2 = new Telerik.WinControls.UI.RadLabel();
                this.radLabel1 = new Telerik.WinControls.UI.RadLabel();
                this.txtPassword = new Telerik.WinControls.UI.RadTextBox();
                this.txtUsername = new Telerik.WinControls.UI.RadTextBox();
                this.btnCancel = new Telerik.WinControls.UI.RadButton();
                this.btnLogin = new Telerik.WinControls.UI.RadButton();
                this.fluentDarkTheme1 = new Telerik.WinControls.Themes.FluentDarkTheme();
                this.fluentTheme1 = new Telerik.WinControls.Themes.FluentTheme();
                this.imagePanel.SuspendLayout();
                ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.radPanel1)).BeginInit();
                this.radPanel1.SuspendLayout();
                ((System.ComponentModel.ISupportInitialize)(this.radLabel3)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.radLabel2)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.radLabel1)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.txtPassword)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.txtUsername)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.btnCancel)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.btnLogin)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
                this.SuspendLayout();
                //
                // imagePanel
                //
                this.imagePanel.Controls.Add(this.logoPictureBox);
                this.imagePanel.Dock = System.Windows.Forms.DockStyle.Left;
                this.imagePanel.Location = new System.Drawing.Point(0, 0);
                this.imagePanel.Name = "imagePanel";
                this.imagePanel.Size = new System.Drawing.Size(129, 148);
                this.imagePanel.TabIndex = 9;
                //
                // logoPictureBox
                //
                this.logoPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
                this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
                this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image")));
                this.logoPictureBox.Location = new System.Drawing.Point(0, 0);
                this.logoPictureBox.Name = "logoPictureBox";
                this.logoPictureBox.Size = new System.Drawing.Size(129, 148);
                this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
                this.logoPictureBox.TabIndex = 0;
                this.logoPictureBox.TabStop = false;
                //
                // radPanel1
                //
                this.radPanel1.Controls.Add(this.radLabel3);
                this.radPanel1.Controls.Add(this.radLabel2);
                this.radPanel1.Controls.Add(this.radLabel1);
                this.radPanel1.Controls.Add(this.txtPassword);
                this.radPanel1.Controls.Add(this.txtUsername);
                this.radPanel1.Location = new System.Drawing.Point(152, 12);
                this.radPanel1.Name = "radPanel1";
                this.radPanel1.Size = new System.Drawing.Size(369, 117);
                this.radPanel1.TabIndex = 10;
                this.radPanel1.Text = "radPanel1";
                this.radPanel1.ThemeName = "FluentDark";
                //
                // radLabel3
                //
                this.radLabel3.AutoSize = false;
                this.radLabel3.Location = new System.Drawing.Point(3, 74);
                this.radLabel3.Name = "radLabel3";
                this.radLabel3.Size = new System.Drawing.Size(123, 24);
                this.radLabel3.TabIndex = 18;
                this.radLabel3.Text = "Password";
                this.radLabel3.ThemeName = "FluentDark";
                //
                // radLabel2
                //
                this.radLabel2.AutoSize = false;
                this.radLabel2.Location = new System.Drawing.Point(3, 48);
                this.radLabel2.Name = "radLabel2";
                this.radLabel2.Size = new System.Drawing.Size(123, 24);
                this.radLabel2.TabIndex = 17;
                this.radLabel2.Text = "UserName";
                this.radLabel2.ThemeName = "FluentDark";
                //
                // radLabel1
                //
                this.radLabel1.Location = new System.Drawing.Point(3, 12);
                this.radLabel1.Name = "radLabel1";
                this.radLabel1.Size = new System.Drawing.Size(156, 18);
                this.radLabel1.TabIndex = 16;
                this.radLabel1.Text = "Please enter your login details";
                this.radLabel1.ThemeName = "FluentDark";
                //
                // txtPassword
                //
                this.txtPassword.Location = new System.Drawing.Point(132, 76);
                this.txtPassword.Name = "txtPassword";
                this.txtPassword.Size = new System.Drawing.Size(192, 24);
                this.txtPassword.TabIndex = 15;
                this.txtPassword.ThemeName = "FluentDark";
                this.txtPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPassword_KeyDown);
                //
                // txtUsername
                //
                this.txtUsername.Location = new System.Drawing.Point(132, 48);
                this.txtUsername.Name = "txtUsername";
                this.txtUsername.Size = new System.Drawing.Size(192, 24);
                this.txtUsername.TabIndex = 14;
                this.txtUsername.ThemeName = "FluentDark";
                //
                // btnCancel
                //
                this.btnCancel.Location = new System.Drawing.Point(527, 42);
                this.btnCancel.Name = "btnCancel";
                this.btnCancel.Size = new System.Drawing.Size(110, 24);
                this.btnCancel.TabIndex = 12;
                this.btnCancel.Text = "Cancel";
                this.btnCancel.ThemeName = "FluentDark";
                //
                // btnLogin
                //
                this.btnLogin.Location = new System.Drawing.Point(527, 12);
                this.btnLogin.Name = "btnLogin";
                this.btnLogin.Size = new System.Drawing.Size(110, 24);
                this.btnLogin.TabIndex = 11;
                this.btnLogin.Text = "Login";
                this.btnLogin.ThemeName = "FluentDark";
                this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
                //
                // Login
                //
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(660, 148);
                this.Controls.Add(this.imagePanel);
                this.Controls.Add(this.radPanel1);
                this.Controls.Add(this.btnCancel);
                this.Controls.Add(this.btnLogin);
                this.MaximizeBox = false;
                this.MinimizeBox = false;
                this.Name = "Login";
                //
                //
                //
                this.RootElement.ApplyShapeToControl = true;
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                this.Text = "Login";
                this.ThemeName = "Fluent";
                this.Load += new System.EventHandler(this.Login_Load);
                this.imagePanel.ResumeLayout(false);
                ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.radPanel1)).EndInit();
                this.radPanel1.ResumeLayout(false);
                this.radPanel1.PerformLayout();
                ((System.ComponentModel.ISupportInitialize)(this.radLabel3)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.radLabel2)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.radLabel1)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.txtPassword)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.txtUsername)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.btnCancel)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.btnLogin)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
                this.ResumeLayout(false);
     
            }
     
            #endregion
     
            private System.Windows.Forms.Panel imagePanel;
            private System.Windows.Forms.PictureBox logoPictureBox;
            private Telerik.WinControls.UI.RadPanel radPanel1;
            private Telerik.WinControls.UI.RadLabel radLabel3;
            private Telerik.WinControls.UI.RadLabel radLabel2;
            private Telerik.WinControls.UI.RadLabel radLabel1;
            private Telerik.WinControls.UI.RadTextBox txtPassword;
            private Telerik.WinControls.UI.RadTextBox txtUsername;
            private Telerik.WinControls.UI.RadButton btnCancel;
            private Telerik.WinControls.UI.RadButton btnLogin;
            private Telerik.WinControls.Themes.FluentDarkTheme fluentDarkTheme1;
            private Telerik.WinControls.Themes.FluentTheme fluentTheme1;
        }
    }

     

     

     

     

     

     

     

  2. Dimitar
    Admin
    Dimitar avatar
    2926 posts

    Posted 19 Mar 2019 Link to this post

    Hello David,

    I was not able to reproduce the observed behavior on my end. For convenience, I prepared a small sample, based on the information that you provided so far and attached it to this thread. 
    Could you please check it and let me know what I need to change in order to reproduce that? 

    Thank you in advance for your patience and cooperation. 

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top