任何人都可以向我解释如何让可视状态管理器使用WPF应用程序吗?它刚被添加到新的wpftoolkit中.我按照说明安装了它,但即使样本也没有显示VSM.在Silverlight中,它可以工作,但不能在WPF中工作.如果安装了最新的Blend 2并使用SP1进行了更新.
任何人都有关于如何使用(最好)Visual Studio 2008在WPF网格中插入行或列的任何建议?
添加一个新的RowDefinition或者没有问题ColumnDefinition,但我真的不太兴奋增加Grid.Row或者Grid.Column插入受影响的大量单元格的前景.有没有人想出一个聪明的方法来自动化这个(也许用正则表达式查找/替换操作)?
如果在Studio中无法完成,可以在Blend中完成吗?
我在silverlight控件上使用了几个Blend行为和触发器.我想知道是否有任何机制可以自动分离或确保在不再使用控件时(即从可视树中删除)为行为或触发器调用OnDetaching().
我的问题是,由于其中一个行为,控件存在托管内存泄漏.该行为在OnAttached()重写中的某个长期对象上订阅一个事件,并且应该在OnDetaching()重写中取消订阅该事件,以便它可以成为垃圾收集的候选者.但是,当我从可视树中删除控件时,OnDetaching()似乎永远不会被调用...我能够实现它的唯一方法是在删除控件之前明确地分离有问题的行为,然后正确地进行垃圾回收.
现在我唯一的解决方案是在代码隐藏中为控件创建一个公共方法,该方法可以通过并分离任何可能导致垃圾收集问题的已知行为.在从面板中删除控件之前,要由客户端代码知道调用它.我真的不喜欢这种方法,所以我正在寻找一些自动的方法,这是我忽略或更好的建议.
public void DetachBehaviors()
{
     foreach (var behavior in Interaction.GetBehaviors(this.LayoutRoot))
     {
          behavior.Detach();
     }
     //continue detaching all known problematic behaviors on the control....
}
silverlight garbage-collection memory-leaks attachedbehaviors expression-blend
更新:使用Expression Blend 3
我正在尝试为WPF应用程序中的一类按钮设置IsPressed和IsEnabled(false)属性触发器的样式.
这是一个带有Button的UserControl,使用样式...
<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="Kiosk.ButtonTest"
    x:Name="UserControl">
    <Grid x:Name="LayoutRoot">
        <Button HorizontalAlignment="Left" Style="{DynamicResource BlueButton}" VerticalAlignment="Top" Width="155" Content="Button" Height="52.9"/>
    </Grid>
</UserControl>
这是风格片段......
   <!-- Blue Button -->
   <Style x:Key="BlueButton" TargetType="{x:Type Button}">
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="{DynamicResource BlueGradient3}"/>
        </Trigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Background" Value="{DynamicResource DarkGradient1}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BlueGradient3}"/>
        </Trigger>
        <Trigger Property="IsPressed" Value="True">
            <Setter Property="Background" Value="{DynamicResource DarkGradient1}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BlueGradient1}"/>
        </Trigger>
    </Style.Triggers>
    <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
    <Setter Property="Background" Value="{DynamicResource BlueGradient1}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource BlueGradient2}"/> …尝试在WPF(C#/ XAML,.NET 4.0)WebBrowser应用程序中测试基本浏览器概念.到目前为止,唯一的问题是以编程方式缩放.有没有人有这方面的经验?
MSDN列出什么:http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx 此外,我曾尝试过各种东西,如选择的RenderTransform不得要领.这是不可能的或没有记录.我希望后者.请注意,WinForm解决方案是不可接受的.
提前感谢任何帮助,Beems
.NET 4.5是就地升级,因此取代了.NET 4.0.因此,当我使用Visual Studio 2012安装.NET 4.5时,我无法再为.NET 4.0开发应用程序.
由于Windows XP不支持.NET 4.5,如何在安装Visual Studio 2012后维护现有的.NET 4.0应用程序仍然必须在Windows XP下运行?
到目前为止,只要安装了VS2003,我就可以为每个版本甚至.NET 1.1开发.NET应用程序.我没有问题微软不支持XP上的.NET 4.5,我认为切断旧东西是可以的.但是,由于我们仍然有客户使用Windows XP,我们需要能够在.NET 4.5的同时创建.NET 4.0程序.
编辑:
我刚刚遇到了第一个不兼容问题:我在Windows Server 2012上安装了VS 2012.我创建了一个面向.NET 4.0的项目.在blend 4.0中,我创建了一个复选框的控件模板的副本.生成的模板包含仅在.NET 4.5下可用的颜色的引用.解决方案无法再编译.但是,同样的情况在我的Windows 7安装上运行正常.
我假设.NET 4.5的安装已经取代了我的标准控件的控件模板.因此我不能再创建副本了.
我正在寻找一种方法将Snapped Visual State添加到我的Windows 8应用程序中.根据MSDN,我可以通过在设备下选择此项并启用"启用状态记录"来完成此操作.但是,此选项已禁用.显示的唯一视觉状态是"".如何启用此选项以便我可以编辑此状态?
我是否需要在XAML中手动创建可视状态?
它总是说"解决方案"foo.sln"格式不受支持,可能无法正确打开.你想打开解决方案吗?" 如果我单击是,它显示解决方案树,但是当我打开一个xaml文件时,它只显示其xaml文本,而不是UI的渲染.
根据这个http://blendinsider.com/technical/available-now-blend-for-visual-studio-2012-2012-08-15/ Blend 4是它的工作方式.所以我觉得有些不对劲.
我使用vs2010和Blend 4创建了较旧的项目.在vs2012中处理它们时,我仍然可以在Blend 4中打开并使用它们.只有使用vs2012创建的新项目似乎对我有这个问题.
我需要Blend 4来调用一些初始化代码才能合理地显示我的应用程序,我正在使用Josh Smith的这种方法来完成它.
我使用以下项目结构:
MainProgram
  -- Properties
     -- AssemblyInfo.cs (including the custom attribute)
  -- App.xaml
  -- HostWindow.xaml    (UserControls are embedded here)
  -- DesignTimeBootstrapperAttribute.cs
ViewsAssembly
  -- Lots of user controls
出于某种原因,每次构建后都不会调用设计时引导程序(导致我的自定义标记扩展在Blend中抛出异常和大量错误消息).然而,在最初加载解决方案时调用它,我不理解Blend在这里的行为方式.
我做错了什么,还是有另一种方法?
编辑: 我注意到,完成重建确实每次调用Bootstrapper.也许这可以作为一种解决方法,但我仍然想了解它.
我用DatePicker创建了一个简单的Expression Blend 4项目。我编辑了DatePicker的模板(包括其DatePickerTextBox),将水印文本从“选择日期”更改为“ dd / mm / yyyy”。Blend中生成的XAML将样式应用于原始DatePicker,并且此样式作为资源存储在Window.Resources中。但是,对水印文本所做的编辑不会生效。有任何想法吗?谢谢。(请注意,我不想求助于代码,我想了解如何使用Blend来实现。)这是窗口的XAML:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
x:Class="HelloWorldBlen.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">
<Window.Resources>
    <Style x:Key="DatePickerStyle1" TargetType="{x:Type DatePicker}">
        <Setter Property="Foreground" Value="#FF333333"/>
        <Setter Property="IsTodayHighlighted" Value="True"/>
        <Setter Property="SelectedDateFormat" Value="Short"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint=".5,0" StartPoint=".5,1">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DatePicker}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"> …expression-blend ×10
wpf ×7
xaml ×6
c# ×3
.net-4.0 ×2
.net-4.5 ×1
datepicker ×1
grid ×1
memory-leaks ×1
silverlight ×1
windows-8 ×1
windows-xp ×1
wpf-controls ×1