C1MessageBox button content

Posted by: stefan.nerlich on 8 August 2019, 8:02 pm EST

    • Post Options:
    • Link

    Posted 8 August 2019, 8:02 pm EST

    Hi,

    how can we modify the content for the C1MessageBox buttons and translate the button text to the current UICulture?

    
    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(delegate {
        IList<DependencyObject> list = new List<DependencyObject>();
        VTreeHelper.GetChildrenOfType(Application.Current.MainWindow, typeof(C1Window), ref list);
        if (list != null
            && list.Count > 0) {
            C1Window mBox = (C1Window)list[0];
    
            list = new List<DependencyObject>();
            VTreeHelper.GetChildrenOfType(mBox, typeof(StackPanel), ref list);
            if (list != null
                && list.Count > 0) {
                StackPanel sPanel = (StackPanel)list[0];
    
                list = new List<DependencyObject>();
                VTreeHelper.GetChildrenOfType(sPanel, typeof(Button), ref list);
                if (list.Count > 0) {
    
                    var dstButton = list.First() as Button;
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
    
                        dstButton.Content is Grid ... 
    
                    }));
                }
            }
        }
    }));
    
    
  • Posted 11 August 2019, 8:41 pm EST - Updated 4 October 2022, 12:04 am EST

    Hello Stefan,

    As I understand, you wish to change the content of C1MessageBoxButtons and want to get them localized.

    For this, you need to Change the UI Culture of your application to the desired culture, as follows:

    public MainWindow()
    {                       
            Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture;
            Language = System.Windows.Markup.XmlLanguage.GetLanguage("de-DE");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");
            InitializeComponent();
    }
    

    Best wishes,

    Ruchir

  • Posted 11 August 2019, 9:37 pm EST - Updated 4 October 2022, 12:04 am EST

    Hi Ruchir,

    thank you for your quick response … iam already setting the UICulture and Language Properperty … however the final result should look something like this:

  • Posted 12 August 2019, 10:14 pm EST - Updated 4 October 2022, 12:04 am EST

    Hello,

    There is no direct way to add image to C1MessageBoxButton in WPF. However, just like image can be added to standard Button, C1MessageBoxButton too allows adding image/icon through modifying button’s Content.



    Content_C1MessageBox.zip

    Best wishes,

    Ruchir

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels