小编Sre*_*moh的帖子

如何在Visual Studio 2012中安装ASP.NET MVC 5?

有没有办法在Visual Studio 2012中安装ASP.NET MVC 5?

我尝试过使用NuGet(http://www.nuget.org/packages/Microsoft.AspNet.Mvc).但我认为它应该作为Visual Studio扩展,但我无法在任何地方找到它.

或者它仅在Visual Studio 2013中可用?

visual-studio-2012 asp.net-mvc-5

114
推荐指数
6
解决办法
16万
查看次数

如何创建WPF ControlTemplate

嗨伙计们,我正在尝试创建linkbutttonlike,如回答这里所说:如何使WPF按钮看起来像一个链接?

1)我创建了UserControl,默认的xaml看起来像这样:

 <UserControl x:Class="Wpf.Controls.HyperlinkLikeButtonTemplate"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>

    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

2)我放在ControlTemplate里面

<UserControl x:Class="Wpf.Controls.HyperlinkLikeButtonTemplate"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

        <ControlTemplate x:Key="HyperlinkLikeButtonTemplate" TargetType="{x:Type Button}">
            <TextBlock x:Name="innerText" Foreground="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" Cursor="Hand" >
        <ContentPresenter />
            </TextBlock>
            <ControlTemplate.Triggers>
                <Trigger Property="Button.IsMouseOver" Value="true">
                    <Setter TargetName="innerText" Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                    <Setter TargetName="innerText" Property="TextDecorations" Value="Underline" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <Style x:Key="HyperlinkLikeButton" TargetType="{x:Type Button}">
            <Setter Property="Template" Value="{StaticResource HyperlinkLikeButtonTemplate}" />
        </Style>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

但是获得错误属性"内容"只能设置一次.

看起来我做错了什么?

c# wpf

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net-mvc-5 ×1

c# ×1

visual-studio-2012 ×1

wpf ×1