首页 > 其他分享 >Wpf ComboBoxItem show multi fields

Wpf ComboBoxItem show multi fields

时间:2024-03-31 22:12:08浏览次数:20  
标签:fields message xamlReader value System ComboBoxItem Wpf Summary stack

<Window x:Class="WpfApp28.MainWindow"
        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"
        xmlns:local="clr-namespace:WpfApp28"
        mc:Ignorable="d" WindowState="Maximized"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <StackPanel>
            <TextBlock Text="Select Book" FontSize="20" FontStyle="Italic" FontWeight="UltraBold" />
            <ComboBox x:Name="cbx" ItemsSource="{Binding BooksCollection}"
              DisplayMemberPath="{Binding Name}" SelectedIndex="0" FontSize="20"  
              SelectedValuePath="{Binding Id}" HorizontalAlignment="Left"  
              VerticalAlignment="Center" VerticalContentAlignment="Center" Height="50" 
                      Width="1200" BorderThickness="3" BorderBrush="Red" >
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock>
                            <TextBlock.Text>
                                <MultiBinding StringFormat="{}{0}-----{1}-----{2}">
                                    <Binding Path="Id" />
                                    <Binding Path="Name"/>
                                    <Binding Path="Author"/>
                                </MultiBinding>
                            </TextBlock.Text>
                        </TextBlock>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>
    </Grid>
</Window>



using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; 

namespace WpfApp28
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window,INotifyPropertyChanged
    {
        private List<Book> booksCollection;
        public List<Book> BooksCollection
        {
            get
            {
                return booksCollection;
            }
            set
            {
                if(value!=booksCollection)
                {
                    booksCollection = value;
                    OnPropertyChanged("BooksCollection");
                }
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;
            Init();
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(string propName)
        {
            var handler= PropertyChanged;
            if(handler != null)
            {
                handler.Invoke(this, new PropertyChangedEventArgs(propName));
            } 
        }

        void Init()
        {
            BooksCollection = new List<Book>();
            for(int i=0;i<10;i++)
            {
                BooksCollection.Add(new Book()
                {
                    Id=i+1,
                    Name=$"Name{Guid.NewGuid().ToString()}",
                    Author=$"Author{Guid.NewGuid().ToString()}"
                });
            } 
        }
    }

    public class Book
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Author { get; set; }
        public string Description { get; set; }
    }
}

 

 

 

<ComboBox x:Name="cbx" ItemsSource="{Binding BooksCollection}"
  DisplayMemberPath="{Binding Name}" SelectedIndex="0" FontSize="20"  
  SelectedValuePath="{Binding Id}" HorizontalAlignment="Left"  
  VerticalAlignment="Center" VerticalContentAlignment="Center" Height="50" 
          Width="1200" BorderThickness="3" BorderBrush="Red" >
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock>
                <TextBlock.Text>
                    <MultiBinding StringFormat="{}{0}-----{1}-----{2}">
                        <Binding Path="Id" />
                        <Binding Path="Name"/>
                        <Binding Path="Author"/>
                    </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

 

<TextBlock>
    <TextBlock.Text>
        <MultiBinding StringFormat="{}{0}-----{1}-----{2}">
            <Binding Path="Id" />
            <Binding Path="Name"/>
            <Binding Path="Author"/>
        </MultiBinding>
    </TextBlock.Text>
</TextBlock>

 

 

//WpfXamlLoader Load


private static object Load(System.Xaml.XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
{
    XamlObjectWriter xamlObjectWriter = null;
    XamlContextStack<WpfXamlFrame> stack = new XamlContextStack<WpfXamlFrame>(() => new WpfXamlFrame());
    int persistId = 1;
    settings.AfterBeginInitHandler = delegate (object sender, XamlObjectEventArgs args)
    {
        if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordXamlBaml, EventTrace.Level.Verbose))
        {
            IXamlLineInfo xamlLineInfo2 = xamlReader as IXamlLineInfo;
            int num = -1;
            int num2 = -1;
            if (xamlLineInfo2 != null && xamlLineInfo2.HasLineInfo)
            {
                num = xamlLineInfo2.LineNumber;
                num2 = xamlLineInfo2.LinePosition;
            }

            EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientParseXamlBamlInfo, EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordXamlBaml, EventTrace.Level.Verbose, (args.Instance == null) ? 0 : PerfService.GetPerfElementID(args.Instance), num, num2);
        }

        if (args.Instance is UIElement uIElement)
        {
            uIElement.SetPersistId(persistId++);
        }

        XamlSourceInfoHelper.SetXamlSourceInfo(args.Instance, args, baseUri);
        if (args.Instance is DependencyObject dependencyObject && stack.CurrentFrame.XmlnsDictionary != null)
        {
            XmlnsDictionary xmlnsDictionary = stack.CurrentFrame.XmlnsDictionary;
            xmlnsDictionary.Seal();
            XmlAttributeProperties.SetXmlnsDictionary(dependencyObject, xmlnsDictionary);
        }

        stack.CurrentFrame.Instance = args.Instance;
        if (xamlReader is RestrictiveXamlXmlReader && args != null)
        {
            if (args.Instance is ResourceDictionary resourceDictionary)
            {
                resourceDictionary.IsUnsafe = true;
            }
            else if (args.Instance is Frame frame)
            {
                frame.NavigationService.IsUnsafe = true;
            }
            else if (args.Instance is NavigationWindow navigationWindow)
            {
                navigationWindow.NavigationService.IsUnsafe = true;
            }
        }
    };
    xamlObjectWriter = ((writerFactory == null) ? new XamlObjectWriter(xamlReader.SchemaContext, settings) : writerFactory.GetXamlObjectWriter(settings));
    IXamlLineInfo xamlLineInfo = null;
    try
    {
        xamlLineInfo = xamlReader as IXamlLineInfo;
        IXamlLineInfoConsumer xamlLineInfoConsumer = xamlObjectWriter;
        bool shouldPassLineNumberInfo = false;
        if (xamlLineInfo != null && xamlLineInfo.HasLineInfo && xamlLineInfoConsumer != null && xamlLineInfoConsumer.ShouldProvideLineInfo)
        {
            shouldPassLineNumberInfo = true;
        }

        IStyleConnector styleConnector = rootObject as IStyleConnector;
        TransformNodes(xamlReader, xamlObjectWriter, onlyLoadOneNode: false, skipJournaledProperties, shouldPassLineNumberInfo, xamlLineInfo, xamlLineInfoConsumer, stack, styleConnector);
        xamlObjectWriter.Close();
        return xamlObjectWriter.Result;
    }
    catch (Exception ex)
    {
        if (CriticalExceptions.IsCriticalException(ex) || !XamlReader.ShouldReWrapException(ex, baseUri))
        {
            throw;
        }

        XamlReader.RewrapException(ex, xamlLineInfo, baseUri);
        return null;
    }
}

internal static void TransformNodes(System.Xaml.XamlReader xamlReader, XamlObjectWriter xamlWriter, bool onlyLoadOneNode, bool skipJournaledProperties, bool shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack<WpfXamlFrame> stack, IStyleConnector styleConnector)
{
    while (xamlReader.Read())
    {
        if (shouldPassLineNumberInfo && xamlLineInfo.LineNumber != 0)
        {
            xamlLineInfoConsumer.SetLineInfo(xamlLineInfo.LineNumber, xamlLineInfo.LinePosition);
        }

        switch (xamlReader.NodeType)
        {
            case System.Xaml.XamlNodeType.NamespaceDeclaration:
                xamlWriter.WriteNode(xamlReader);
                if (stack.Depth == 0 || stack.CurrentFrame.Type != null)
                {
                    stack.PushScope();
                    for (WpfXamlFrame wpfXamlFrame = stack.CurrentFrame; wpfXamlFrame != null; wpfXamlFrame = (WpfXamlFrame)wpfXamlFrame.Previous)
                    {
                        if (wpfXamlFrame.XmlnsDictionary != null)
                        {
                            stack.CurrentFrame.XmlnsDictionary = new XmlnsDictionary(wpfXamlFrame.XmlnsDictionary);
                            break;
                        }
                    }

                    if (stack.CurrentFrame.XmlnsDictionary == null)
                    {
                        stack.CurrentFrame.XmlnsDictionary = new XmlnsDictionary();
                    }
                }

                stack.CurrentFrame.XmlnsDictionary.Add(xamlReader.Namespace.Prefix, xamlReader.Namespace.Namespace);
                break;
            case System.Xaml.XamlNodeType.StartObject:
                WriteStartObject(xamlReader, xamlWriter, stack);
                break;
            case System.Xaml.XamlNodeType.GetObject:
                xamlWriter.WriteNode(xamlReader);
                if (stack.CurrentFrame.Type != null)
                {
                    stack.PushScope();
                }

                stack.CurrentFrame.Type = stack.PreviousFrame.Property.Type;
                break;
            case System.Xaml.XamlNodeType.EndObject:
                xamlWriter.WriteNode(xamlReader);
                if (stack.CurrentFrame.FreezeFreezable && xamlWriter.Result is Freezable freezable && freezable.CanFreeze)
                {
                    freezable.Freeze();
                }

                if (xamlWriter.Result is DependencyObject dependencyObject && stack.CurrentFrame.XmlSpace.HasValue)
                {
                    XmlAttributeProperties.SetXmlSpace(dependencyObject, stack.CurrentFrame.XmlSpace.Value ? "default" : "preserve");
                }

                stack.PopScope();
                break;
            case System.Xaml.XamlNodeType.StartMember:
                {
                    if ((!xamlReader.Member.IsDirective || !(xamlReader.Member == XamlReaderHelper.Freeze)) && xamlReader.Member != XmlSpace.Value && xamlReader.Member != XamlLanguage.Space)
                    {
                        xamlWriter.WriteNode(xamlReader);
                    }

                    stack.CurrentFrame.Property = xamlReader.Member;
                    if (!skipJournaledProperties || stack.CurrentFrame.Property.IsDirective)
                    {
                        break;
                    }

                    WpfXamlMember wpfXamlMember = stack.CurrentFrame.Property as WpfXamlMember;
                    if (!(wpfXamlMember != null))
                    {
                        break;
                    }

                    DependencyProperty dependencyProperty = wpfXamlMember.DependencyProperty;
                    if (dependencyProperty == null || !(dependencyProperty.GetMetadata(stack.CurrentFrame.Type.UnderlyingType) is FrameworkPropertyMetadata frameworkPropertyMetadata) || !frameworkPropertyMetadata.Journal)
                    {
                        break;
                    }

                    int num = 1;
                    while (xamlReader.Read())
                    {
                        switch (xamlReader.NodeType)
                        {
                            case System.Xaml.XamlNodeType.StartMember:
                                num++;
                                break;
                            case System.Xaml.XamlNodeType.StartObject:
                                {
                                    XamlType type = xamlReader.Type;
                                    XamlType xamlType = type.SchemaContext.GetXamlType(typeof(BindingBase));
                                    XamlType xamlType2 = type.SchemaContext.GetXamlType(typeof(DynamicResourceExtension));
                                    if (num == 1 && (type.CanAssignTo(xamlType) || type.CanAssignTo(xamlType2)))
                                    {
                                        num = 0;
                                        WriteStartObject(xamlReader, xamlWriter, stack);
                                    }

                                    break;
                                }
                            case System.Xaml.XamlNodeType.EndMember:
                                num--;
                                if (num == 0)
                                {
                                    xamlWriter.WriteNode(xamlReader);
                                    stack.CurrentFrame.Property = null;
                                }

                                break;
                            case System.Xaml.XamlNodeType.Value:
                                if (xamlReader.Value is DynamicResourceExtension)
                                {
                                    WriteValue(xamlReader, xamlWriter, stack, styleConnector);
                                }

                                break;
                        }

                        if (num == 0)
                        {
                            break;
                        }
                    }

                    break;
                }
            case System.Xaml.XamlNodeType.EndMember:
                {
                    WpfXamlFrame currentFrame = stack.CurrentFrame;
                    XamlMember property = currentFrame.Property;
                    if ((!property.IsDirective || !(property == XamlReaderHelper.Freeze)) && property != XmlSpace.Value && property != XamlLanguage.Space)
                    {
                        xamlWriter.WriteNode(xamlReader);
                    }

                    currentFrame.Property = null;
                    break;
                }
            case System.Xaml.XamlNodeType.Value:
                WriteValue(xamlReader, xamlWriter, stack, styleConnector);
                break;
            default:
                xamlWriter.WriteNode(xamlReader);
                break;
        }

        if (onlyLoadOneNode)
        {
            break;
        }
    }
}

 

private static readonly Dictionary<ContentType, StreamToObjectFactoryDelegateCore> _objectConvertersCore = new Dictionary<ContentType, StreamToObjectFactoryDelegateCore>(9, new ContentType.WeakComparer());




internal static void RegisterCore(ContentType contentType, StreamToObjectFactoryDelegateCore method)
{
    _objectConvertersCore[contentType] = method;
}

 

 

/
// Summary:
//     Describes the priorities at which operations can be invoked by way of the System.Windows.Threading.Dispatcher.
public enum DispatcherPriority
{
    //
    // Summary:
    //     The enumeration value is -1. This is an invalid priority.
    Invalid = -1,
    //
    // Summary:
    //     The enumeration value is 0. Operations are not processed.
    Inactive,
    //
    // Summary:
    //     The enumeration value is 1. Operations are processed when the system is idle.
    SystemIdle,
    //
    // Summary:
    //     The enumeration value is 2. Operations are processed when the application is
    //     idle.
    ApplicationIdle,
    //
    // Summary:
    //     The enumeration value is 3. Operations are processed after background operations
    //     have completed.
    ContextIdle,
    //
    // Summary:
    //     The enumeration value is 4. Operations are processed after all other non-idle
    //     operations are completed.
    Background,
    //
    // Summary:
    //     The enumeration value is 5. Operations are processed at the same priority as
    //     input.
    Input,
    //
    // Summary:
    //     The enumeration value is 6. Operations are processed when layout and render has
    //     finished but just before items at input priority are serviced. Specifically this
    //     is used when raising the Loaded event.
    Loaded,
    //
    // Summary:
    //     The enumeration value is 7. Operations processed at the same priority as rendering.
    Render,
    //
    // Summary:
    //     The enumeration value is 8. Operations are processed at the same priority as
    //     data binding.
    DataBind,
    //
    // Summary:
    //     The enumeration value is 9. Operations are processed at normal priority. This
    //     is the typical application priority.
    Normal,
    //
    // Summary:
    //     The enumeration value is 10. Operations are processed before other asynchronous
    //     operations. This is the highest priority.
    Send
}
#region Assembly WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// location unknown
// Decompiled with ICSharpCode.Decompiler 8.1.1.7464
#endregion

using System.Security;
using MS.Internal.WindowsBase;

namespace System.Windows.Interop;

//
// Summary:
//     Contains message information from a thread's message queue.
[Serializable]
public struct MSG
{
    [SecurityCritical]
    private IntPtr _hwnd;

    [SecurityCritical]
    private int _message;

    [SecurityCritical]
    private IntPtr _wParam;

    [SecurityCritical]
    private IntPtr _lParam;

    [SecurityCritical]
    private int _time;

    [SecurityCritical]
    private int _pt_x;

    [SecurityCritical]
    private int _pt_y;

    //
    // Summary:
    //     Gets or sets the window handle (HWND) to the window whose window procedure receives
    //     the message.
    //
    // Returns:
    //     The window handle (HWND).
    public IntPtr hwnd
    {
        [SecurityCritical]
        get
        {
            return _hwnd;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _hwnd = value;
        }
    }

    //
    // Summary:
    //     Gets or sets the message identifier.
    //
    // Returns:
    //     The message identifier.
    public int message
    {
        [SecurityCritical]
        get
        {
            return _message;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _message = value;
        }
    }

    //
    // Summary:
    //     Gets or sets the wParam value for the message, which specifies additional information
    //     about the message. The exact meaning depends on the value of the message.
    //
    // Returns:
    //     The wParam value for the message.
    public IntPtr wParam
    {
        [SecurityCritical]
        get
        {
            return _wParam;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _wParam = value;
        }
    }

    //
    // Summary:
    //     Gets or sets the lParam value that specifies additional information about the
    //     message. The exact meaning depends on the value of the System.Windows.Interop.MSG.message
    //     member.
    //
    // Returns:
    //     The lParam value for the message.
    public IntPtr lParam
    {
        [SecurityCritical]
        get
        {
            return _lParam;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _lParam = value;
        }
    }

    //
    // Summary:
    //     Gets or sets the time at which the message was posted.
    //
    // Returns:
    //     The time that the message was posted.
    public int time
    {
        [SecurityCritical]
        get
        {
            return _time;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _time = value;
        }
    }

    //
    // Summary:
    //     Gets or sets the x coordinate of the cursor position on the screen, when the
    //     message was posted.
    //
    // Returns:
    //     The x coordinate of the cursor position.
    public int pt_x
    {
        [SecurityCritical]
        get
        {
            return _pt_x;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _pt_x = value;
        }
    }

    //
    // Summary:
    //     Gets or sets the y coordinate of the cursor position on the screen, when the
    //     message was posted.
    //
    // Returns:
    //     The y coordinate of the cursor position.
    public int pt_y
    {
        [SecurityCritical]
        get
        {
            return _pt_y;
        }
        [SecurityCritical]
        set
        {
            SecurityHelper.DemandUnrestrictedUIPermission();
            _pt_y = value;
        }
    }

    [SecurityCritical]
    [FriendAccessAllowed]
    internal MSG(IntPtr hwnd, int message, IntPtr wParam, IntPtr lParam, int time, int pt_x, int pt_y)
    {
        _hwnd = hwnd;
        _message = message;
        _wParam = wParam;
        _lParam = lParam;
        _time = time;
        _pt_x = pt_x;
        _pt_y = pt_y;
    }
}
#if false // Decompilation log
'13' items in cache
------------------
Resolve: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Found single assembly: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll'
------------------
Resolve: 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Found single assembly: 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xaml.dll'
------------------
Resolve: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Found single assembly: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll'
------------------
Resolve: 'Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Could not find by name: 'Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
------------------
Resolve: 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Found single assembly: 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll'
------------------
Resolve: 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Found single assembly: 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll'
------------------
Resolve: 'System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Could not find by name: 'System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
------------------
Resolve: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Could not find by name: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
#endif

 

 

#region Assembly mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll
// Decompiled with ICSharpCode.Decompiler 8.1.1.7464
#endregion

namespace System.Security;

//
// Summary:
//     Specifies that code or an assembly performs security-critical operations.
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
[__DynamicallyInvokable]
public sealed class SecurityCriticalAttribute : Attribute
{
    private SecurityCriticalScope _val;

    //
    // Summary:
    //     Gets the scope for the attribute.
    //
    // Returns:
    //     One of the enumeration values that specifies the scope of the attribute. The
    //     default is System.Security.SecurityCriticalScope.Explicit, which indicates that
    //     the attribute applies only to the immediate target.
    [Obsolete("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
    public SecurityCriticalScope Scope => _val;

    //
    // Summary:
    //     Initializes a new instance of the System.Security.SecurityCriticalAttribute class.
    [__DynamicallyInvokable]
    public SecurityCriticalAttribute()
    {
    }

    //
    // Summary:
    //     Initializes a new instance of the System.Security.SecurityCriticalAttribute class
    //     with the specified scope.
    //
    // Parameters:
    //   scope:
    //     One of the enumeration values that specifies the scope of the attribute.
    public SecurityCriticalAttribute(SecurityCriticalScope scope)
    {
        _val = scope;
    }
}
#if false // Decompilation log
'13' items in cache
#endif

 

标签:fields,message,xamlReader,value,System,ComboBoxItem,Wpf,Summary,stack
From: https://www.cnblogs.com/Fred1987/p/18107361

相关文章

  • WPF如何封装一个可扩展的Window
    前言   WPF中Window相信大家都很熟悉,有时我们有一些自定义需求默认Window是无法满足的,比如在标题栏上放一些自己东西,这个时候我们就需要写一个自己的Window,实现起来也很简单,只要给Window设置一个WindowChrome.WindowChrome附加属性就可以实现,WindowChrome可以让你自定义窗口......
  • WPF Yolov 体验
    参考Yolov中文文档yolov8_wpf_example(简单搜索到的一个示例程序)本文源码【下载】环境软件/系统版本说明WindowsWindows10专业版22H219045.4170MicrosoftVisualStudioMicrosoftVisualStudioCommunity2022(64位)-17.6.5Microsoft.NetSD......
  • 一个可以让你有更多时间摸鱼的WPF控件(二)
    前言  上文介绍了如何通过一个Form自定义控件来简化数据的录入,并自动实现数据校验,自动布局排列等功能。本文继续介绍如何优化表格控件的使用,缩减代码量,实现工作效率的提升。一、功能实现   上文中分析了DataGrid跟ListView两种表格控件的优劣,在这里我们选择ListView来实......
  • WPF中继承ItemsControl子类控件数据模板获取选中属性
    需求场景列表类控件,如ListBox、ListView、DataGrid等。显示的行数据中,部分内容依靠选中时触发控制,例如选中行时行记录复选,部分列内容控制显隐。案例源码以ListView为例。Xaml部分<ListViewItemsSource="{BindingMyPropertys}"IsManipulationEnabled="False"><List......
  • WPF中使用PDF模板实现PDF导出和预览-来自GPT4
    在C#和WPF项目中实现加载不同的PDF模板、查看报告和导出PDF文件的功能,可以通过以下步骤完成:1.选择PDF库首先,选择一个合适的.NETPDF库。有许多库可以帮助你处理PDF文件,包括但不限于:iTextSharp:一个功能强大的和灵活的库,适用于创建和修改PDF文件。它是iText的一个.NET端口。......
  • WPF中实现动态表单-来自GPT4的回答
    实现C#和WPF项目中的动态表单功能,需要在后端设计灵活的数据结构来存储表单配置(例如字段名、字段类型等),同时前端需要能够解析这些配置并据此生成相应的控件。以下是一种可能的实现方法:1.数据库设计你的数据库需要至少包含两个表:一个用于存储表单字段的配置,另一个用于存储用户输......
  • wpf write value to config file and read the persisted value
    <Windowx:Class="WpfApp26.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.......
  • WPF实现placeholder效果
     概述:WPF中通过`Style`实现TextBox水印文本,使用`WatermarkTextBox`类及`ControlTemplate`。这个示例通过`VisualStateManager`在文本框失去焦点且内容为空时显示水印文本。通过`Watermark`属性简化水印文本设置,提高可维护性。在WPF中,通过Style实现TextBox中的水印文本(水印、......
  • 一个可以让你有更多时间摸鱼的WPF控件(一)
    前言我们平时在开发软件的过程中,有这样一类比较常见的功能,它没什么技术含量,开发起来也没有什么成就感,但是你又不得不花大量的时间来处理它,它就是对数据的增删改查。当我们每增加一个需求就需要对应若干个页面来处理数据的添加、修改、删除、查询,每个页面因为数据字段的差异需要单......
  • 抢先看!界面控件DevExpress WPF 2024产品路线图预览(一)
    DevExpressWPF拥有120+个控件和库,将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpressWPF能创建有着强大互动功能的XAML基础应用程序,这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。本文将介绍2024年DevExpressWPF第一个主要更新(v2......