返回首页

安迪bricklets的自定义渲染

回答

评论会员:萨沙理发 时间:2011/12/27
优秀文章!我发现你如何能做到本地化的描述更容易。是否确定有公共资源(标准是内部的),你也可以使用下面的代码本地化描述。在构造函数中的属性信息获取存储。信息是后来用于获取资源的价值。在这个版本中,你也可以在运行时切换UI区域性


    [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]

    public sealed class LocDescriptionAttribute : DescriptionAttribute

    {

        #region Public methods.

        // ------------------------------------------------------------------



        /// 

        /// Initializes a new instance of the 

        ///  class.

        /// 

        /// Property Name

        /// Type of the resources.

        public LocDescriptionAttribute (string propertyName, Type resourcesType) : base(propertyName)

        {

            _resProp = resourcesType.GetProperty(propertyName);

            if (_resProp == null)

                throw new ArgumentException("Property not found", propertyName);

            MethodInfo mi = _resProp.GetGetMethod();

            if (mi == null)

                throw new ArgumentException("Property has no getter", propertyName);

            if (!mi.IsStatic)

                throw new ArgumentException("Expected static property", propertyName);

        }

 

        #endregion

 

        #region Public properties.

 

        /// 

        /// Get the string value from the resources.

        /// 

        /// 

        /// The description stored in this attribute.

        public override string Description

        {

            get

            {

                return _resProp.GetValue(null, null).ToString();

            }

        }

        #endregion

 

        #region Private variables.

 

        private readonly PropertyInfo _resProp;

 

        #endregion

    }

评论会员:埃里克韦莱 时间:2011/12/27

萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为

我的博客:{A}
评论会员:尤金Sadovoi 时间:2011/12/27
!!我还是继续过一段时间,发现这篇文章非常有用
感谢这么多
评论会员:CIDev 时间:2011/12/27
有用的东西,THX分享
评论会员:萨沙理发 时间:2011/12/27
有用的文章。我特别喜欢被制成可本地化的。
仅仅因为代码的工作,但这并不意味着它是良好的代码
评论会员:会员8180792 时间:2011/12/27

萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为

我的博客:{A}
评论会员:萨沙理发 时间:2011/12/27
嗨,

我有一个项目SMI1002 SOFTSOCCERTRACK和在一个类DBStructure中的枚举Sexe
我试图绑定到我的窗口运动员位于枚举到一个ComboBox

下面是代码:

{C}
我得到了一个错误,说的Sexe typeName是没有找到

能有人帮我图这一个了,请

非常感谢
PK
评论会员:会员8180792 时间:2011/12/27
我觉得有两件事情错

1。 ObjectDataProvider应该使用的GetValues​​
2。对于Enum类型,你需要限定它的命名空间。

我认为这个例子是正确的


public enum SampleEnum

{

     Dog,

     Cat,

     Scrat,

     Hefalump

}

这里是XAML


枚举的是完全合格的,其命名空间
萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为

我的博客:{A}
评论会员:萨沙理发 时间:2011/12/27
您好萨沙,

感谢您的快速响应{S0}

不幸的是,我没有exactlt,它仍然doesnt工作

<Window x:Class="SMI1002.Athletes"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:e ="clr-namespace:System;assembly=mscorlib"

        xmlns:local="clr-namespace:SMI1002"

Title="SMI1002 - Gestion des athl猫tes" Loaded="Athletes_Loaded" Height="470" Width="877" WindowStartupLocation="CenterScreen" WindowState="Normal" WindowStyle="SingleBorderWindow" FontWeight="Bold" Foreground="White" Icon="/Images/SMI1002.png">

    <Window.Resources>

        <ObjectDataProvider x:Key="SexeValues" MethodName="GeValues" ObjectType="{x:Type e:Enum}">

            <ObjectDataProvider.MethodParameters>

                <x:Type TypeName="local:Sexes"/>

            </ObjectDataProvider.MethodParameters>

        </ObjectDataProvider>

    </Window.Resources>

任何其他的想法?

PS:名字空间= SMI1002 / ENUM =性别

感谢
评论会员:萨沙理发 时间:2011/12/27
应该工作。我不知道是怎么回事错误的例子,要诚实,也许后上StackOverflow您的问题。这是我一直做它。

我可以在上面看到一个问题,你有
MethodName="GeValues"
时,应
MethodName="GetValues"

的GetValues​​基本上没有GeValues​​。萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为
我的博客:{A}
评论会员:会员8180792 时间:2011/12/27
这里是我们的工作

xmlns:serviceLayer="clr-namespace:Moneycorp.Gateway;assembly=Moneycorp.Omni.UI.ServiceLayer"

 

<UserControl.Resources>

 

        <ObjectDataProvider MethodName="GetValues"

                            ObjectType="{x:Type sys:Enum}"

                            x:Key="planEnum">

            <ObjectDataProvider.MethodParameters>

                <x:Type TypeName="serviceLayer:PlanType" />

            </ObjectDataProvider.MethodParameters>

        </ObjectDataProvider>

 

 </UserControl.Resources>

<ComboBox ItemsSource="{Binding Source={StaticResource planEnum}}"/>

我们有枚举通过DataContract的WCF
宣布
[DataContract]

   public enum PlanType

   {

       None = 0, // NB. Not serialised



       [EnumMember(Value = "Fixed")]

       Fixed = 1,

 

       [EnumMember(Value = "Fixed Local")]

       FixedLocal = 2,

 

       [EnumMember(Value = "Fixed Settlement")]

       FixedSettlement = 3,

   }
萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为

我的博客:{A}
评论会员:vallarasus 时间:2011/12/27
感谢萨沙你们岩石{S0}
工作现在还不错

PK
评论会员:萨沙理发 时间:2011/12/27
您好萨沙,

我从窗户形式的小白刚刚跳开始进入WPF中,不应把该执行帐户的TypeConverter以及?


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

        {

            if (value != null)

            {

                Type type = TypeDescriptor.GetReflectionType(value);

                while (type.HasElementType)

                {

                    type = type.GetElementType();

                }

                TypeConverter converter = TypeDescriptor.GetConverter(value);

 

                if (converter != null)

                    return converter.ConvertTo(value, typeof(String));

                else

                    return System.Convert.ToString(value, culture);

            }

 

            return string.Empty;

        }

猜"格兰特Frisken"这里有同样的想法,因为我!! :P


Vallarasu S. 修改,2011年8月20日(星期六)4:34
评论会员:大卫Veeneman 时间:2011/12/27
。说实话,很长一段时间,因为我没有任何的WinForms,但我觉得你的代码肯定不会太工作
萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为

我的博客:{A}
评论会员:leder11011 时间:2011/12/27
清晰,简洁,和逻辑。感谢
评论会员:!萨沙理发 时间:2011/12/27
您好萨沙,

我成功实施的一个WPF项目。
友好枚举谢谢你这么远。

让我描述我目前的情况是:

在我的WPF项目中,我有两个窗口。在第一个是与ComboBox中显示友好的枚举。然后我去到第二个窗口上显示一些信息。回到第一个屏幕的方法可行。当我回到第一个屏幕,在ComboBox中输入的信息是复位到其原始状态。我想有改变ComboBox的持久状态:
它是可能的,这怎么可能,保存在两个窗口之间的ComboBox的状态?

请可能会问,如果我能提供更多的信息,并阐述你后,因为我是新来WPF。

再次感谢
格里特
评论会员:会员659912 时间:2011/12/27
多数民众赞成的声音更多的是与您的应用程序比这个特定的ComboBox的枚举文章,是没有办法,我可以回答,因为其过多的应用程序的具体你的查询。对不起男子
萨沙理发
微软的Visual C#MVP 2008年2011Codeproject MVP 2008 - 2011Open源码

你最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为

我的博客:{A}
评论会员:游客 时间:2011/12/27
会员659912|嗨,萨沙:我需要通过方法的参数的枚举值。在WPF我该怎么办呢?(注:在以前的帖子下面的消息在某种程度上被截断,转贴在这里)我有一个WPF页,其中包含在不同大陆的公司列表。我需要在页面显示用户选择的大陆和ComboBox的国家。检索国家清单时,我需要通过大陆枚举值在视图动态的方法(基于大陆公司是英寸,如果我想在WPF视图定义ObjectDataProvider,我怎么做呢?{BR}代码示例:codepre spanclass="code-keyword"public/spanspanclass="code-keyword"enum/spanContinental{ Asia, Europ, NorthAmerica, Africa} spanclass="code-keyword"public/spanspanclass="code-keyword"class/spanCountryDataSvc{ spanclass="code-keyword"public/spanspanclass="code-keyword"static/spanIListGetCountriesInContinental(Continental) { spanclass="code-comment"///spanspanclass="code-comment"Retrievethecountriesbasedoncontinental/span IListcountries=...... spanclass="code-keyword"return/spancountries; }} spanclass="code-keyword"public/spanspanclass="code-keyword"class/spanCountryViewModel{ spanclass="code-keyword"public/spanIListGetCoutriesInAsia() { IListcountriesInAsia=CountryDataSvc.GetCountriesInContinental(Continental.Asia); spanclass="code-keyword"return/spancountriesInAsia; }}/pre/code感谢阿伦
MaksAnt
评论会员:游客 时间:2011/12/27
嗨,萨沙:我需要通过方法的参数的枚举值。在WPF我该怎么办呢?例如:codepre spanclass="code-keyword"public/spanspanclass="code-keyword"enum/spanContinental{ Asia, Europ, NorthAmerica, Africa} spanclass="code-keyword"public/spanspanclass="code-keyword"class/spanCountryDataSvc{ spanclass="code-keyword"public/spanspanclass="code-keyword"static/spanIListGetCountriesInContinental(Continental) { spanclass="code-comment"///spanspanclass="code-comment"Retrievethecountriesbasedoncontinental/span IListcountries=...... spanclass="code-keyword"return/spancountries; }} spanclass="code-comment"///spanspanclass="code-comment"Clientretrievingthecountriesbasedoncontinental/spanspanclass="code-keyword"public/spanspanclass="code-keyword"class/spanCountryViewModel{ spanclass="code-keyword"public/spanIListGetCoutriesInAsia() { IListcountriesInAsia=CountryDataSvc.GetCountriesInContinental(Continental.Asia); spanclass="code-keyword"return/spancountriesInAsia; }} /pre/code我有一个WPF页,其中包含在不同大陆的公司列表。我需要在页面显示用户选择的大陆和ComboBox的国家。检索国家清单时,我需要通过大陆枚举值在视图动态的方法(基于大陆公司是英寸,如果我想在WPF视图定义ObjectDataProvider,我怎么做呢?{BR}感谢阿伦
王哈
评论会员:游客 时间:2011/12/27
imgsrc=http://www.orcode.com/upimg/2011_12_27_15_03_12_4.gif的
萨沙理发
评论会员:游客 时间:2011/12/27
你的文章是非常冷静和本地化解决我的问题但它也造成了一点问题,我的组合框的样式。我有以下样式(实际上是从{A14}复制])。无论我怎么尝试,我有没有办法设置中脱颖而出的底色。如果我删除"ComboBox.ItemTemplate",以使其显示枚举值,然后我就可以看到所有指定的颜色在我的花式,没有问题。任何想法?窗口的X:类="Wpf_ComboBoxTest.Window1" XMLNS="htt​​p://schemas.microsoft.com/winfx/2006/xaml/presentation"的xmlns:X="htt​​p://schemas.microsoft.com/winfx/2006/xaml"的xmlns:SYS="CLR的命名空间:系统;大会=mscorlib程序"XMLNS:枚举="CLR命名空间:Wpf_ComboBoxTest" XMLNS:CNV="CLR命名空间:Wpf_ComboBoxTest" 标题="Window1的"高度="300"宽度="300"GT;LT;Window.Resourcesgt;LT;ObjectDataProviderx键="positionData"methodName中="的GetValues​​"的ObjectType="{X:键入sys:枚举}"GT;LT;ObjectDataProvider.MethodParametersgt;LT,X:类型typename="枚举:食品"/GT;LT/ObjectDataProvider.MethodParametersgt;LT/ObjectDataProvidergt;LT-ComboBox的切换按钮-LT;ControlTemplate的x键="ComboBoxToggleButton"的TargetType="{X:类型ToggleButton的}"LT;电网TextBlock.Foreground="绿色"TextBlock.FontSize="25"GTLT;Grid.ColumnDefinitionsgt;LT;ColumnDefinition/GT;LT;ColumnDefinition宽度="20"/LT/Grid.ColumnDefinitionsgt;矩形的x:名称="矩形"Grid.ColumnSpan="2"Horizo​​ntalAlignment="拉伸"VerticalAlignment="拉伸"WIDTH="自动"高度="自动"RadiusX="10"RadiusY="10"TextBlock.Foreground="绿色"GT;LT;Rectangle.Fillgt;LT;LinearGradientBrush的EndPoint="0,1"的起始点="0,0"GT;LT;GradientStop的颜色="#EEE的"偏移="0.0"/GT;LT;GradientStop的颜色="#CCC"偏移="1.0"/GT;LT/LinearGradientBrushgt;LT/Rectangle.Fillgt;LT;Rectangle.Strokegt;LT;LinearGradientBrush的EndPoint="0,1"的起始点="0,0"GT;LT;GradientStop的颜色="#CCC"偏移="0.0"/GT;LT;GradientStop的颜色="#444"偏移="1.0"/GT;LT/LinearGradientBrushgt;LT/Rectangle.Strokegt;LT/Rectanglegt;LT;矩形Grid.Column="0"Horizo​​ntalAlignment="拉伸"VerticalAlignment="拉伸"WIDTH="自动"高度="自动"RadiusX="10"RadiusY="10"TextBlock.Foreground="绿色"GT;LT;Rectangle.Fillgt;LT;SolidColorBrush的Color="#353533"/GT;LT/Rectangle.Fillgt;LT;Rectangle.Strokegt;LT;LinearGradientBrush的EndPoint="0,1"的起始点="0,0"GT;LT;GradientStop的颜色="#CCC"偏移="0.0"/GT;LT;GradientStop的颜色="#444"偏移="1.0"/GT;LT/LinearGradientBrushgt;LT/Rectangle.Strokegt;LT/Rectanglegt;LT;路径X:名称="箭"Grid.Column="1"Horizo​​ntalAlignment="中心"VerticalAlignment="中心"数据的"M00大号44升80Z"的GT;LT;Path.Fillgt;LT;SolidColorBrush的Color="#444"/GT;LT/Path.Fillgt;LT/Pathgt;LT/Gridgt;LT;ControlTemplate.Triggersgt;LT;触发属性="IsMouseOver"值="真正的"GTLT;setter属性="填充"TARGETNAME="矩形"GTLT;Setter.Valuegt;LT;LinearGradientBrush的EndPoint="0,1"的起始点="0,0"GT;LT;GradientStop的颜色="#FFF"偏移="0.0"/GT;LT;GradientStop的颜色="#AAA"偏移="1.0"/GT;LT/LinearGradientBrushgt;LT/Setter.Valuegt;LT/Settergt;LT/Triggergt;LT;触发属性="的IsChecked"值="真正的"GTLT;setter属性="填充"TARGETNAME="矩形"GTLT;Setter.Valuegt;LT;LinearGradientBrush的EndPoint="0,1"的起始点="0,0"GT;LT;GradientStop的颜色="BBB"的偏移="0.0"/GT;LT;GradientStop的颜色="#EEE的"偏移="0.1"/GT;LT;GradientStop的颜色="#EEE的"偏移="0.9"/GT;LT;GradientStop的颜色="#FFF"偏移="1.0"/GT;LT/LinearGradientBrushgt;LT/Setter.Valuegt;LT/Settergt;LT/Triggergt;LT触发属性="IsEnabled"值="假"GT;LT;setter属性="填充"TARGETNAME="矩形"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#EEE"/GT;LT/Setter.Valuegt;LT/Settergt;LT;setter属性="中风"TARGETNAME="矩形"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#AAA级"/GT;LT/Setter.Valuegt;LT/Settergt;LT;setter属性="前景"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#888"/GT;LT/Setter.Valuegt;LT/Settergt;LT;setter属性="填充"TARGETNAME="箭"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#888"/GT;LT/Setter.Valuegt;LT/Settergt;LT/Triggergt;LT/ControlTemplate.Triggersgt;LT/ControlTemplategt;LT-ComboBox中的TextBox-LT;ControlTemplate的x键="ComboBoxTextBox"的TargetType="{X:TextBox类型}"LT-这必须命名为PART_ContentHost-GT;边界X:名称="PART_ContentHost"聚焦的="假"的背景="{TemplateBinding来背景}"/GT;LT/ControlTemplategt;LT;样式的TargetType="{X:类型组合框}"GT;LTsetter属性="SnapsToDevicePixels"价值="真"/GT;LTsetter属性="前景"="绿色"GT,LT;/Settergt;LT;setter属性="模板"GTLT;Setter.Valuegt;LT;的TargetType的ControlTemplate="{X:类型组合框}"LT;Gridgt;LT-ToggleButton的数据绑定到ComboBox的切换IsDropDownOpen-GT;LT;ToggleButton的x:名称="切换按钮"Grid.Column="2"模板="{DynamicResourceComboBoxToggleButton}前景="绿色"可聚焦的"假"的IsChecked="{绑定路径=IsDropDownOpen,模式=TwoWay的RelativeSource={RelativeSourceTemplatedParent}"ClickMode="按下"/GT;LT;的ContentPresenterx:名称="ContentSite"Horizo​​ntalAlignment="左"的VerticalAlignment="中心"保证金="3,3,23,3"内容="{TemplateBinding来SelectionBoxItem}的ContentTemplate="{TemplateBinding来SelectionBoxItemTemplate}"ContentTemplateSelector="{TemplateBinding来ItemTemplateSelector}"IsHitTestVisible="FALSE"/GT;-TextBox的PART_EditableTextBox或ComboBox不会承认它必须被命名为-LT;TextBox的x:名称="PART_EditableTextBox"可视性="隐藏"模板="{DynamicResourceComboBoxTextBox}Horizo​​ntalAlignment="左"保证金="3,3,23,3"VerticalAlignment="中心"STYLE="{X:NULL}"可聚焦="真正的"背景"透明"的IsReadOnly="{TemplateBinding来的IsReadOnly}"/GT;LT-弹出窗口显示在ComboBox中的项目清单。ISOPEN是数据绑定到IsDropDownOpen通过ComboBoxToggleButton-GT切换;LT;弹出式x:名称="弹出式"ISOPEN="{TemplateBinding来IsDropDownOpen}"安置="底部"聚焦的"假"AllowsTransparency="真"PopupAnimation="幻灯片"GT;网格X:名称="下拉"MaxHeight="{TemplateBinding来MaxDropDownHeight}"MinWidth="{TemplateBinding来的ActualWidth}"SnapsToDevicePixels="真正的"GTLT(x);边境:名称="DropDownBorder"BorderBrush的="{DynamicResourceSolidBorderBrush}"的BorderThickness="1"GTLT;Border.Backgroundgt;LT;SolidColorBrush的Color="#FFF"/GT;LT/Border.Backgroundgt;LT/Bordergt;LT;ScrollViewer的保证金="4,6,4,6"STYLE="{DynamicResourcePropertyGridScrollViewer}"SnapsToDevicePixels="真"Horizo​​ntalScrollBarVisibility="自动"VerticalScrollBarVisibility="自动"CanContentScroll="真"GTLT-StackPanel的使用,以显示设置IsItemsHost为True的孩子-GT;LT;StackPanel的IsItemsHost="真"KeyboardNavigation.DirectionalNavigation="载"/GTLT/ScrollViewergt;LT/Gridgt;LT/Popupgt;LT/Gridgt;LT;ControlTemplate.Triggersgt;LT;-这迫使下拉菜单中有一个最小尺寸,如果它是空的-GT;LT;触发属性="HasItems"值="假"GTLTsetter属性="MinHeight"值="95"TARGETNAME="DropDownBorder"/GT;LT/Triggergt;LT触发属性="IsEnabled"值="假"GT;LT;setter属性="前景"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#888"/GT;LT/Setter.Valuegt;LT/Settergt;LT/Triggergt;LT;触发属性="IsGrouping"值="真正的"GTLTsetter属性="ScrollViewer.CanContentScroll"价值="假"/GT;LT/Triggergt;LT;触发属性="AllowsTransparency"的SourceName="popup"的价值="真正的"GT;LTsetter属性="CornerRadius"值="4"TARGETNAME="DropDownBorder"/GT;LTsetter属性="保证金"="0,2,0,0"TARGETNAME="DropDownBorder"/GT;LT/Triggergt;LT;触发属性="IsEditable"值="真正的"GTLT;setter属性="IsTabStop"值="假"/GTLT;setter属性="能见度"值="可见"TARGETNAME="PART_EditableTextBox"/GT;LTsetter属性="知名度"="隐藏"的targetName="ContentSite"/GT;LT/Triggergt;LT/ControlTemplate.Triggersgt;LT/ControlTemplategt;LT/Setter.Valuegt;LT/Settergt;LT/Stylegt;LT-大联大ComboBoxItem-GT;LT;样式的TargetType="{X:类型ComboBoxItem}"GT;LTsetter属性="SnapsToDevicePixels"价值="真"/GT;LT;setter属性="模板"GTLT;Setter.Valuegt;LT的ControlTemplate的TargetType="{X:类型ComboBoxItem}"GT;LT;电网SnapsToDevicePixels="TRUE"GTLT;边境x:名称="边界"背景="{TemplateBinding来背景}"BorderBrush的="{TemplateBinding来BorderBrush的}"的BorderThickness="{TemplateBinding来的BorderThickness}"/GT;LT;的ContentPresenterHorizo​​ntalAlignment="{TemplateBinding来Horizo​​ntalContentAlignment}"VerticalAlignment="{TemplateBinding来VerticalContentAlignment}"/LT/Gridgt;LT;ControlTemplate.Triggersgt;LT-IsHighlightedSelectedBackgroundBrush更改设置的项目选择颜色-GT;LT;触发属性="IsHighlighted"值="真正的"GTLT;setter属性="背景"TARGETNAME="边框"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#DDD"/GT;LT/Setter.Valuegt;LT/Settergt;LT/Triggergt;LT触发属性="IsEnabled"值="假"GT;LT;setter属性="前景"GTLT;Setter.Valuegt;LT;SolidColorBrush的Color="#888"/GT;LT/Setter.Valuegt;LT/Settergt;LT/Triggergt;LT/ControlTemplate.Triggersgt;LT/ControlTemplategt;LT/Setter.Valuegt;LT/Settergt;LT/Stylegt;LT/Window.Resourcesgt;LT;网格背景="黄河"GT;LT;Grid.RowDefinitionsgt;LT;RowDefinition高度="30"/RowDefinitiongt;LT;RowDefinitiongt;LT;/RowDefinitiongt;LT/Grid.RowDefinitionsgt;LT;ComboBox的x:名称="cmbWatermarkTextPosition" Grid.Row="0"="{的ItemsSource绑定源={的StaticResourcepositionData}}"HEIGHT="自动"GT;LT;!--{BR}LT;ComboBox.ItemTemplategt;LT;D​​ataTemplategt;LT;标签内容="{绑定路径=.,模式=单向}"VerticalAlignment="中心"/GTLT/DataTemplategt;LT/ComboBox.ItemTemplategt;-GT;LT/ComboBoxgt;LT/Gridgt;LT/Windowgt;{A15}哈迪修改上周五,2009年1月2日下午02:57
SuperCriller
评论会员:游客 时间:2011/12/27
我不会有时间来看看这一切的样式信息,但我想尝试的是一个渐进的方式,尝试运用的某些部分,本ComboBox的模板,或者尝试找到位文本(应该是我认为的Con​​tentPresenter),然后使用像TextElement.Foreground="黑色"的ContentPresenterTextElements前景附加属性萨沙理发微软的VisualC#MVP2008CodeprojectMVP2008Your最好的朋友就是你。我是我最好的朋友。我们有着共同的看法,并未落认为我的博客:{A}
萨沙理发
评论会员:游客 时间:2011/12/27
在VS2008设计窗口抛出以下异常时,试图显示Window1.xaml中的文件。有没有办法以解决这一问题呢?未将对象引用设置到对象的实例。FriendlyEnumValues​​.EnumToFriendlyNameConverter.Convert(对象的值,类型TARGETTYPE,对象参数,CultureInfo的文化)在C:\Documents和25System.Windows.Data.BindingExpression.TransferValue(布尔isASubPropertyChange对象newValue)在System.Windows.Data.BindingExpression.Activate(对象的Item)System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt未遂)System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(布尔lastChance)MS.Internal.Data.DataBindEngine.Task.Run(布尔lastChance)MS.Internal.Data.DataBindEngine.Run(对象arg的)System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象ARGS,布尔isSingleParameter)在System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象的源,委托回调,对象ARGS,布尔isSingleParameter,代表catchHandler),基督教霍尔姆