locked
Visual Studio 2013 Automatically Adding FontFamily Attribute to TextBlock Elements

    Question

  • While working with TextBlocks in my Windows Store Xaml, Visual Studio 2013 often unexpectedly adds the following attribute to some of my TextBlocks:
    FontFamily="Global User Interface"
    It does this even if I have already added a Style attribute that sets the FontFamily property. I have not noticed any specific conditions that cause it to do this, and it does not prevent me from removing the attribute after it adds it, but it is definitely annoying to need to remove it all the time. It does not do this with any other attributes, and it does not try to use values other than "Global User Interface". Why is Visual Studio 2013 trying to add an attribute at seemingly random times that I did not ask it to add, and how can I prevent it from doing this? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Sunday, June 15, 2014 3:29 AM

All replies

  • Hi,

    Because your issue is more related to Windows Store app and Store app control, I moved this thread to Building Windows Store apps with C# or VB forum for better support. VS
    General Question forum  mainly discusses
    the usage of Visual Studio IDE such as WPF & SL designer,
    Visual Studio Guidance Automation Toolkit, Developer Documentation and Help
    System
    and Visual Studio Editor.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, June 17, 2014 6:03 AM
  • Hello,

    Do you mind attaching a sample project that demonstrates the issue? I've seen it few times on my Visual Studio, however, when I close and reopen the project the issue goes away and I wasn't able to pinpoint it now.

    Thanks,

    Nikola Mihaylov

    Visual Studio Product Team, Microsoft

    Monday, July 28, 2014 6:19 PM
  • I'm really not sure what you are asking for. You say that you've seen it and that it goes away when you close and reopen the project. It seems to be very inconsistent and random, it might end up happening in a TextBlock that I have not touched in days, I might not see it in days and then it comes back. And because it is not a compilation or coding error, I can't really provide any code. The inconsistency and randomness makes it seem hard to demonstrate or pinpoint, I think it is simply a bug in Visual Studio 2013. It has happened in brand new projects and projects I have been working on for over a year, not only in different projects but different solutions as well. If you really want me to create a project and attach it, I can, but there wouldn't be much point to sending a project in which I haven't even changed a single character other than sticking in one empty TextBlock.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Monday, July 28, 2014 7:10 PM
  • For what it's worth, I thought I could provide a repro, because this has happened to me a ton!

    However, now that I need it to: I can't get it to fail on demand.  (I'll be updating my app tomorrow, and I guarantee the reverse will be true: I won't be able to get it to not happen.)

    I grabbed a screen cap of it failing, but as soon as I tried to create a couple of projects to show off only that problem, I couldn't get it to fail again.  Note that there is something involved with the FontFamily and Style.  Where there is no Style set, the editor is happy.  Also note, you don't have to click the design-time surface, you can click the XAML in the XAML editor on a control and the same thing will happen (for me at least.)

    I can't even get it to fail now within the same project solution that I took the video cap in less than half an hour ago.  Frustrating!

    This really needs to be fixed.  I found 30 FontFamily="Global User Interface " scattered through my project.  Blah.


    Darin R.


    • Edited by Darin Rousseau Tuesday, July 29, 2014 12:46 AM bad splelling
    Tuesday, July 29, 2014 12:42 AM
  • I never noticed that connection between FontFamily and Style before, you're definitely have good noticing details & patterns! It obviously doesn't fix the bug/problem, but it is definitely good information to know (and it may help the people at Microsoft fix the bug). Thank you for your input!

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Tuesday, July 29, 2014 1:36 AM
  • Did you ever receive an answer for this?  We are struggling with the exact same issue and its making working in our xaml very, very difficult while in Visual Studio.   We are introducing random bugs into the app by just working in a xaml file because it keeps adding that FontFamily to almost anything in the file while it is open.  It happens automatically on lines were not even editing.
    Thursday, December 11, 2014 3:39 PM
  • Unfortunately, no, it still does it to me at seemingly random times. I'm really hoping it gets fixed in the next version of Visual Studio, but until then I wrote a .bat file for Visual Studio to use to check the files for me when I build my solution (it doesn't stop it from building, but it lets me know that the unwanted attribute has been added to my code). If you want a copy of this .bat file, I can give it to you, but like I said, it still doesn't fix the problem.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Thursday, December 11, 2014 3:53 PM
  • The latest VS and Blend update seems to make the problem happen less for me, but it still happens. 

    I find that somehow the editors get into that mode where it adds it, and every node I either click on or edit gets effected.

    I close VS (or Blend) and usually it goes away for a while, but not all the time.


    Darin R.

    Thursday, December 11, 2014 3:54 PM