<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re : Layer Combobox tool in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772079#M38952</link>
    <description>Just found the missing bit for the WinForms solution: &lt;A href="http://stackoverflow.com/q/18521110/200443" target="_blank"&gt;http://stackoverflow.com/q/18521110/200443&lt;/A&gt;</description>
    <pubDate>Fri, 14 Aug 2015 18:39:31 GMT</pubDate>
    <dc:creator>FRFR1426</dc:creator>
    <dc:date>2015-08-14T18:39:31Z</dc:date>
    <item>
      <title>Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5770561#M38943</link>
      <description>&lt;P&gt;Hello Every body :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i hope to fine any combox &amp;nbsp;tool like autocad layer combox tool .. to design my custom layer manger :: can i find it ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://www.shinetutorial.com/autocad/level_1/images/object_layer.gif" border="0" alt="" title="" width="344" height="176" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 20:28:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5770561#M38943</guid>
      <dc:creator>Amremad</dc:creator>
      <dc:date>2015-08-13T20:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5770689#M38944</link>
      <description>&lt;P&gt;That looks like a datagridview control with image and text columns. &amp;nbsp;I can't help with adapting it for the ribbon but there are plenty of posts here on that topic. &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 22:09:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5770689#M38944</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2015-08-13T22:09:39Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771056#M38945</link>
      <description>&lt;P&gt;If you can use WPF, there is a way to get a list of layers with their properties (Color, IsOff...) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows.Data;

namespace MyNameSpace
{
    public partial class LayerManagerWindow
    {
        public DataItemCollection Layers { get; set; }

        public LayerManagerWindow()
        {
            InitializeComponent();

            Layers = Application.UIBindings.Collections.Layers;

            DataContext = this;
        }
    }
}

&amp;lt;Window x:Class="MyNameSpace.LayerManagerWindow"
             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"&amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;Grid.RowDefinitions&amp;gt;
            &amp;lt;RowDefinition Height="Auto" /&amp;gt;
        &amp;lt;/Grid.RowDefinitions&amp;gt;
        &amp;lt;ComboBox ItemsSource="{Binding Layers}"&amp;gt;
            &amp;lt;ComboBox.ItemTemplate&amp;gt;
                &amp;lt;DataTemplate&amp;gt;
                    &amp;lt;StackPanel Orientation="Horizontal"&amp;gt;
                        &amp;lt;TextBlock Text="{Binding Color}" /&amp;gt;
                        &amp;lt;TextBlock Text="{Binding Name}" Margin="7,0,0,0" /&amp;gt;
                    &amp;lt;/StackPanel&amp;gt;
                &amp;lt;/DataTemplate&amp;gt;
            &amp;lt;/ComboBox.ItemTemplate&amp;gt;
        &amp;lt;/ComboBox&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Aug 2015 06:47:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771056#M38945</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-14T06:47:51Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771293#M38946</link>
      <description>&lt;P&gt;sorry i didnt use wpf before .. and i didn't understand your answer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so can you send me the code that working with this way and i will understand it after run it &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 11:10:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771293#M38946</guid>
      <dc:creator>Amremad</dc:creator>
      <dc:date>2015-08-14T11:10:28Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771616#M38947</link>
      <description>&lt;P&gt;Here is a WinForms version:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DataItemCollection layers = Autodesk.AutoCAD.ApplicationServices.Application.UIBindings.Collections.Layers;&lt;BR /&gt;var bs = new BindingSource(layers, null);&lt;BR /&gt;comboBox1.DataSource = bs;&lt;BR /&gt;comboBox1.DrawMode = DrawMode.OwnerDrawFixed;&lt;BR /&gt;comboBox1.DrawItem += (o, args) =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt; ICustomTypeDescriptor dataItem = layers[args.Index];&lt;BR /&gt; PropertyDescriptorCollection properties = dataItem.GetProperties();&lt;BR /&gt; var color = (Autodesk.AutoCAD.Colors.Color) properties["Color"].GetValue(dataItem);&lt;BR /&gt; Rectangle bounds = args.Bounds;&lt;BR /&gt; int itemHeight = bounds.Height;&lt;BR /&gt; Graphics graphics = args.Graphics;&lt;BR /&gt; args.DrawBackground();&lt;BR /&gt; var rect = new Rectangle(bounds.Left + 1, bounds.Top + 1, itemHeight - 2, itemHeight - 2);&lt;BR /&gt; graphics.FillRectangle(new SolidBrush(color.ColorValue), rect);&lt;BR /&gt; graphics.DrawRectangle(new Pen(Color.Black), rect);&lt;BR /&gt; graphics.DrawString((string) properties["Name"].GetValue(dataItem), args.Font, &lt;BR /&gt; new SolidBrush(args.ForeColor), bounds.Left + itemHeight + 6, bounds.Top + 1);&lt;BR /&gt; args.DrawFocusRectangle();&lt;BR /&gt;};&lt;/PRE&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/183551iE9F0BA03623C1C4F/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="2015-08-14_162608.png" title="2015-08-14_162608.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I haven't found a way to sort the layers by their name and I'm running out of time. You should iterate the layer table to construct your list and then sort it.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 14:34:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771616#M38947</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-14T14:34:16Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771698#M38948</link>
      <description>&lt;P&gt;I cannot give up so easily, it's stronger than me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DataItemCollection layers = Autodesk.AutoCAD.ApplicationServices.Application.UIBindings.Collections.Layers;
List&amp;lt;ICustomTypeDescriptor&amp;gt; list = layers.OfType&amp;lt;ICustomTypeDescriptor&amp;gt;().ToList();
list.Sort((a, b) =&amp;gt; string.Compare(
    ((string) (a.GetProperties()["Name"].GetValue(a))), (string) (b.GetProperties()["Name"].GetValue(b)), StringComparison.CurrentCulture));
comboBox1.DataSource = list;
comboBox1.DrawMode = DrawMode.OwnerDrawFixed;
comboBox1.DrawItem += (o, args) =&amp;gt;
{
    ICustomTypeDescriptor dataItem = list[args.Index];
    PropertyDescriptorCollection properties = dataItem.GetProperties();
    var color = (Autodesk.AutoCAD.Colors.Color) properties["Color"].GetValue(dataItem);
    Rectangle bounds = args.Bounds;
    int itemHeight = bounds.Height;
    Graphics graphics = args.Graphics;
    args.DrawBackground();
    var rect = new Rectangle(bounds.Left + 1, bounds.Top + 1, itemHeight - 2, itemHeight - 2);
    graphics.FillRectangle(new SolidBrush(color.ColorValue), rect);
    graphics.DrawRectangle(new Pen(Color.Black), rect);
    graphics.DrawString((string) properties["Name"].GetValue(dataItem), args.Font, 
        new SolidBrush(args.ForeColor), bounds.Left + itemHeight + 6, bounds.Top + 1);
    args.DrawFocusRectangle();
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 15:00:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771698#M38948</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-14T15:00:56Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771918#M38949</link>
      <description>&lt;P&gt;thank you very much ..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but i know this way .. &amp;nbsp; your combobox doesn't have click on every item like autocad combobox .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need when user click on color rectangle he can choose another color &amp;nbsp;like autocad combobox . i hope you understand me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so is WPF give what i want ???&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 16:52:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5771918#M38949</guid>
      <dc:creator>Amremad</dc:creator>
      <dc:date>2015-08-14T16:52:23Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772048#M38950</link>
      <description>&lt;P&gt;Yes, in WPF it's simpler to make this kind of custom controls. But I cannot explain WPF in a forum thread...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an article on the WPF combobox: &lt;A href="http://www.wpf-tutorial.com/list-controls/combobox-control/" target="_self"&gt;http://www.wpf-tutorial.com/list-controls/combobox-control/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also make your own control with a popup window like this: &lt;A href="http://www.codeproject.com/Articles/27472/ColorComboBox" target="_self"&gt;http://www.codeproject.com/Articles/27472/ColorComboBox&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 18:15:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772048#M38950</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-14T18:15:03Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772064#M38951</link>
      <description>&lt;P&gt;thank you very much&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm reading now about wpf&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 18:26:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772064#M38951</guid>
      <dc:creator>Amremad</dc:creator>
      <dc:date>2015-08-14T18:26:14Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772079#M38952</link>
      <description>Just found the missing bit for the WinForms solution: &lt;A href="http://stackoverflow.com/q/18521110/200443" target="_blank"&gt;http://stackoverflow.com/q/18521110/200443&lt;/A&gt;</description>
      <pubDate>Fri, 14 Aug 2015 18:39:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772079#M38952</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-14T18:39:31Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772332#M38953</link>
      <description>&lt;P&gt;hi again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i was using &amp;nbsp;this line&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;colorPicker1.SelectedIndex = colorPicker1.Items.IndexOf("Yellow");&lt;/PRE&gt;&lt;P&gt;before using the new combobox ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no this code doesn't work becouse he search in item text , but the correct must searching in SelectedValue&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there another easy way other than using loop ??&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2015 21:56:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/5772332#M38953</guid>
      <dc:creator>Amremad</dc:creator>
      <dc:date>2015-08-14T21:56:03Z</dc:date>
    </item>
    <item>
      <title>Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/6781221#M38954</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very happy if you could provide me coding for C# to display the layer and control the layer by windows form application&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 01:51:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/6781221#M38954</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-04T01:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Re : Layer Combobox tool</title>
      <link>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/12132243#M38955</link>
      <description>&lt;P&gt;Thank you for this helpful code.&lt;/P&gt;&lt;P&gt;Please can you tell me how to show the layerManagerWindow in the ribbon?&lt;/P&gt;&lt;P&gt;Is it possible to do similar ribboncombo with specific elements (Color, checkbox,Text) for each combo item?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 22:42:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/layer-combobox-tool/m-p/12132243#M38955</guid>
      <dc:creator>Mahass</dc:creator>
      <dc:date>2023-07-27T22:42:25Z</dc:date>
    </item>
  </channel>
</rss>

