VS2012 DesignTime 笔记

在 VS2012 DesignTime中,对于通过PropertyValueEditor弹出的Dialog,是不会引用IDE的Theme Setting。

在我们做自定义Dialog时,如何做到同样的效果呢,有两种办法:

1. 使用 DialogPropertyValueEditor + DialogTemplate,这样弹出的Dialog就不会使用IDE的Theme

2. 自定义Dialog,该Dialog.DialogContent 是个Border,并且这个Border.Style应用 “DialogRootContainer” resource,DialogRootContainer定义在 Microsoft.Expression.DesignSurface + userinterface/propertyinspector/propertyinspectorresources.baml 里面,xaml sample 如下

<d:Dialog x:Class="CustomControlLibrary.Design.MyDialog"
        xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d
="clr-namespace:Microsoft.Expression.Utility.Controls;assembly=Microsoft.Expression.Utility"
        Title
="MyDialog" Height="300" Width="300">
    <Border FrameworkElement.Style="{DynamicResource DialogRootContainer}" KeyboardNavigation.TabNavigation="Cycle">
           <StackPanel >
            <TextBox>ccc1231245</TextBox>
        </StackPanel>
    </Border>

</d:Dialog> 

这个人有几点注意:

1.  DialogRootContainer会打断全局Style,所以如果想对Dialog内部的UIElemnt应用Style,请定义在Border以内,不要定义在dialog层

2. 不要加针对于 Microsoft.Expression.DesignSurface + userinterface/propertyinspector/propertyinspectorresources.baml 的resource

 

 

posted @ 2012-09-11 18:59  Alen在西安  阅读(424)  评论(0编辑  收藏  举报