Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8258787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:39:58+00:00 2026-06-08T02:39:58+00:00

I am working on WPF with text. Now I want to edit text using

  • 0

I am working on WPF with text. Now I want to edit text using FontDialog but I cannot set current style of text to FontDialog so the style of text change everytime I call FontDialog. Can you guys help me?

This my code:

System.Windows.Forms.FontDialog fontDialog = new System.Windows.Forms.FontDialog();
        if (fontDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            this.textAnnotation.Font.Size = fontDialog.Font.Size;
            this.textAnnotation.Font.Name = fontDialog.Font.Name;
            this.textAnnotation.Font.Underline = fontDialog.Font.Underline;
            this.textAnnotation.Font.Strikeout = fontDialog.Font.Strikeout;
            this.textAnnotation.Font.Bold = fontDialog.Font.Bold;
            this.textAnnotation.Font.Italic = fontDialog.Font.Italic;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:40:00+00:00Added an answer on June 8, 2026 at 2:40 am

    The Font object in WPF is different than the Font object in Windows Forms which your FontDialog returns.

    1. The Fontsize will not error but WPF Font Sizes are different that WinForms.
    2. You will need to use a FontFamilyConverter to set the Font Name.
    3. The Underline and Strikeout are TextDecorations in WPF
    4. For Font Style and Font Weight propertys you can use conditional logic to set the properties.

    You would be better off using something that is native to Wpf since the Font objects are different. There is a Sample Font Chooser on the Wpf Text blog. I would recommend looking into it.

    something like this:

    System.Windows.Forms.FontDialog fontDialog = new System.Windows.Forms.FontDialog();
    if (fontDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        FontFamilyConverter ffc = new FontFamilyConverter();
    
        this.textAnnotation.FontSize = fontDialog.Font.Size;
        this.textAnnotation.FontFamily =(FontFamily)ffc.ConvertFromString(fontDialog.Font.Name);
    
        if (fontDialog.Font.Bold)
            textAnnotation.FontWeight = FontWeights.Bold;
        else
            textAnnotation.FontWeight = FontWeights.Normal;
    
        if (fontDialog.Font.Italic)
            textAnnotation.FontStyle = FontStyles.Italic;
        else
            textAnnotation.FontStyle = FontStyles.Normal;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in WPF and I need to set the Text and ToolTip
i am working with wpf media element.i want to change the media element source
I am working on WPF app and I want to get news feed using
OK, working on WPF(using MVVM) and came across a question, want some input. I
Im working in WPF and I am trying to change the image of a
I'm working with WPF and EF. I'm using a Datagrid to show information. In
I am working with WPF. I want to create keyboard shortcuts for my WPF
I've got style resources in WPF working so that in my App.xaml I can
I'm working on an WPF application using the mvvm-light framework. I'm new to both
I am working on an app named E-Diary in WPF. Now I have to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.