C1MessageBox button content

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

  • 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 ...

    }));
    }
    }
    }
    }));
  • Replied 11 August 2019, 8:41 pm 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


  • Replied 11 August 2019, 9:37 pm 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:
  • Marked as Answer

    Replied 12 August 2019, 10:14 pm 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