none
"Edit Style - apply resource" option not available

    Question

  • Hello!

    I'm currently reading the Head First C# book, and I'm making the "Save Humans" games and the book is asking me to right click on a textblock and click "Edit Style" and next "apply resource" option and then select the SubheaderTextBlockStyle to make the text bigger.

    The issue is that the 'apply resource' is disabled ('edit current' also) in my VS. 

    Could you please help me with that? How to make this option available? 

    I'm using Visual Studio 2015


    Thanks!

    Lukasz

    Wednesday, May 03, 2017 1:31 PM

All replies

  • Hi wolki91,

    Welcome to the MSDN forum.

    >>>Could you please help me with that? How to make this option available?

    What is your project type? WPF or other? Could you share us some code blocks or some screenshoots to us so that we could reproduce this issue? The more information will help us to find the solution for this question. Thanks.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 04, 2017 6:47 AM
  • Thanks for your replay

    It is WPF project. Below you will find screenshot showing the issue with unavailable option

    Friday, May 05, 2017 11:02 PM
  • @wolki91, sorry for the delay reply. The Apply Resource should be defined in the resources, please refer to below code:

        <Window.Resources>
            <Style x:Key="BodyTextStyle" TargetType="{x:Type TextBlock}">
                <Setter Property="FontFamily" Value="Arial" />
                <Setter Property="TextWrapping" Value="Wrap" />
                <Setter Property="Foreground" Value="Red" />
                <Setter Property="Background" Value="Azure" />
            </Style>
        </Window.Resources>
        <Grid>
            <TextBlock HorizontalAlignment="Left" Height="38" Margin="229,80,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="204"/>
        </Grid>

    After add the custom style, you will notice that Apply Resource could be available:

    For more info about the Style, you can refer to below links for detail:

    https://msdn.microsoft.com/en-us/library/cc294740.aspx


    http://www.wpf-tutorial.com/styles/using-styles/

    http://www.wpftricks.com/2016/12/scope-of-styles.html

    Hope this can help you.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.





    Tuesday, May 09, 2017 1:49 AM