logo
down
shadow

ComboBox with two or more sections


ComboBox with two or more sections

Content Index :

ComboBox with two or more sections
Tag : chash , By : gopal
Date : November 23 2020, 03:01 PM

Hope that helps Summary , XAML:
<ComboBox x:Name="MyComboBox" Height="20">
    <ComboBox.GroupStyle>
        <GroupStyle>
            <GroupStyle.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
            </GroupStyle.HeaderTemplate>
            <GroupStyle.Panel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Vertical" IsItemsHost="True"/>
                </ItemsPanelTemplate>
            </GroupStyle.Panel>
        </GroupStyle>
    </ComboBox.GroupStyle>
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <Rectangle x:Name="Rect" Width="10" Height="10" Fill="{Binding Brush}"/>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Brush}" Value="{x:Null}">
                    <Setter TargetName="Rect" Property="Visibility" Value="Collapsed"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </ComboBox.ItemTemplate>
    <ComboBox.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal" IsItemsHost="True"/>
        </ItemsPanelTemplate>
    </ComboBox.ItemsPanel>
</ComboBox>
    public class BrushData
    {
        public string Type { get; set; }

        public Brush Brush { get; set; }

    }

    public MainWindow()
    {
        InitializeComponent();

        var lists = new List<BrushData>
        {
            new BrushData {Type = "Theme", Brush = Brushes.Red},
            new BrushData {Type = "Theme", Brush = Brushes.Blue},
            new BrushData {Type = "Theme", Brush = Brushes.Orange},
            new BrushData {Type = "Standard", Brush = Brushes.LightGreen},
            new BrushData {Type = "Standard", Brush = Brushes.LightPink},
            new BrushData {Type = "More Colors...", Brush = null}
        };

        var collection = new ListCollectionView(lists);
        collection.GroupDescriptions.Add(new PropertyGroupDescription("Type"));

        MyComboBox.ItemsSource = collection;
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Load sections of ini file to ComboBox in Visual Basic


Tag : vb.net , By : user121350
Date : March 29 2020, 07:55 AM
help you fix your problem First create this class(Source - CodeProject Article):
Imports System.Text
Imports System.Runtime.InteropServices
Public Class INI

    <DllImport("kernel32")> _
    Private Shared Function GetPrivateProfileString(Section As String, Key As String, Value As String, Result As StringBuilder, Size As Integer, FileName As String) As Integer
    End Function


    <DllImport("kernel32")> _
    Private Shared Function GetPrivateProfileString(Section As String, Key As Integer, Value As String, <MarshalAs(UnmanagedType.LPArray)> Result As Byte(), Size As Integer, FileName As String) As Integer
    End Function

    <DllImport("kernel32")> _
    Private Shared Function GetPrivateProfileString(Section As Integer, Key As String, Value As String, <MarshalAs(UnmanagedType.LPArray)> Result As Byte(), Size As Integer, FileName As String) As Integer
    End Function

    Public path As String
    Public Sub New(INIPath As String)
        path = INIPath
    End Sub

    Public Function GetSectionNames() As String()
        Dim maxsize As Integer = 500
        While True
            Dim bytes As Byte() = New Byte(maxsize - 1) {}
            Dim size As Integer = GetPrivateProfileString(0, "", "", bytes, maxsize, path)
            If size < maxsize - 2 Then
                Dim Selected As String = Encoding.ASCII.GetString(bytes, 0, size - (If(size > 0, 1, 0)))
                Return Selected.Split(New Char() {ControlChars.NullChar})
            End If
            maxsize *= 2
        End While
    End Function
    Public Function GetEntryNames(section As String) As String()
        Dim maxsize As Integer = 500
        While True
            Dim bytes As Byte() = New Byte(maxsize - 1) {}
            Dim size As Integer = GetPrivateProfileString(section, 0, "", bytes, maxsize, path)
            If size < maxsize - 2 Then
                Dim entries As String = Encoding.ASCII.GetString(bytes, 0, size - (If(size > 0, 1, 0)))
                Return entries.Split(New Char() {ControlChars.NullChar})
            End If
            maxsize *= 2
        End While
    End Function
    Public Function GetEntryValue(section As String, entry As String) As Object
        Dim maxsize As Integer = 250
        While True
            Dim result As New StringBuilder(maxsize)
            Dim size As Integer = GetPrivateProfileString(section, entry, "", result, maxsize, path)
            If size < maxsize - 1 Then
                Return result.ToString()
            End If
            maxsize *= 2
        End While
    End Function
End Class
Dim _ini As New INI("somefile.ini")
ComboBox1.Items.AddRange(ini.GetSectionNames()) 'For all sections
ComboBox1.Items.Add("section1") 'For specific section(s)
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
    Dim _ini As New INI("somefile.ini")
    Dim section As String = ComboBox1.SelectedItem
    TextBox1.Text = _ini.GetEntryValue(section, "someKey") 'for specific entry
    For Each item In _ini.GetEntryNames(section) 'this is for all entries
        'do whatever you want here with the item variable like this:
        'TextBox1.Text = _ini.GetEntryValue(section, item)...
    Next
End Sub

Is it possible to have multiple sections in UItableView i.e: Section 1 has two sections and these two sections have mult


Tag : ios , By : walshtp
Date : March 29 2020, 07:55 AM
I wish did fix the issue. UITableView has no built in support for this but you could create something yourself with some custom headers and cells.
basically create a model to support the structure:
let model = [[[a, b],[c,d]],[[e,f],[g,h]]]
let subSections = model[section]
var topLevelRow = indexPath.row
for subSection in subSections {
    if topLevelRow < subSection.count {
        print(subSection[topLevelRow])
        break
    } else {
        topLevelRow -= subSection.count
    }
}

QtQuick2 ComboBox with sections


Tag : qt , By : stu73
Date : March 29 2020, 07:55 AM
it should still fix some issue In order to have the same section functionality as a ListView in a ComboBox, you can simply include a ListView in your ComboBox.
You can customize basically all the Qt Quick Controls 2, here is an example for ComboBox : https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-combobox
ComboBox {
    id: control
    width: 200
    model : ["Albert Dupontel","Antoine Griezmann","Peter Sagan","Rodney Mullen","Serena Williams"]
    popup: Popup {
        y: control.height
        width: control.width
        implicitHeight: Math.min(contentItem.implicitHeight, 300)
        padding: 0

        contentItem: ListView {
            clip: true
            implicitHeight: contentHeight
            model: control.popup.visible ? control.delegateModel : null
            currentIndex: control.highlightedIndex
            section.property: "modelData"
            section.criteria: ViewSection.FirstCharacter
            section.delegate: Label {
                x: 10
                text: section
            }

            ScrollIndicator.vertical: ScrollIndicator { }
        }
    }
}

Is -ffunction-sections -fdata-sections and --gc-sections not working?


Tag : c , By : user183345
Date : March 29 2020, 07:55 AM
may help you . The compilation options -ffunction-sections -fdata-sections and linkage option --gc-sections are working correctly in your example. Your static library is superfluous, so it can be simplified to:
$ gcc -ffunction-sections -fdata-sections -c main.c getall.c
$ gcc -Wl,--gc-sections main.o getall.o -Wl,-Map=mapfile
$ nm a.out | grep get
0000000000000657 T get1
...
Discarded input sections
...
 .text.get2     0x0000000000000000        0xd getall.o
 .text.get3     0x0000000000000000        0xd getall.o
...
$ strings a.out | egrep 's97symmqdn-(1|2|3)'
s97symmqdn-1
s97symmqdn-2
s97symmqdn-3
$ objdump -s -j .rodata a.out

a.out:     file format elf64-x86-64

Contents of section .rodata:
 06ed 73393773 796d6d71 646e2d31 00733937  s97symmqdn-1.s97
 06fd 73796d6d 71646e2d 32007339 3773796d  symmqdn-2.s97sym
 070d 6d71646e 2d3300                      mqdn-3.
const char *get1()
{
    static const char s[] = "s97symmqdn-1";
    return s;
}


const char *get2()
{
    static const char s[] = "s97symmqdn-2";
    return s;
}

const char *get3()
{
    static const char s[] = "s97symmqdn-3";
    return s;
}
...
Discarded input sections
...
 .text.get2     0x0000000000000000        0xd getall.o
 .text.get3     0x0000000000000000        0xd getall.o
 .rodata.s.1797
                0x0000000000000000        0xd getall.o
 .rodata.s.1800
                0x0000000000000000        0xd getall.o
...
$ objdump -s -j .rodata.s.1797 getall.o

getall.o:     file format elf64-x86-64

Contents of section .rodata.s.1797:
 0000 73393773 796d6d71 646e2d32 00        s97symmqdn-2.
$ objdump -s -j .rodata.s.1800 getall.o

getall.o:     file format elf64-x86-64

Contents of section .rodata.s.1800:
 0000 73393773 796d6d71 646e2d33 00        s97symmqdn-3.
$ strings a.out | egrep 's97symmqdn-(1|2|3)'
s97symmqdn-1
$ objdump -s -j .rodata a.out

a.out:     file format elf64-x86-64

Contents of section .rodata:
 06f0 73393773 796d6d71 646e2d31 00        s97symmqdn-1.

About -ffunction-sections -fdata-sections and --gc-sections options


Tag : gcc , By : TC.
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • C# GetProcessesByName: issue with colon
  • c# wpf | create complex object with user-defined name to Serialize into JSON
  • How can I get a instance of a generic list with reflection?
  • WPF XAML - Design time and visibility of textbox
  • EF Core and MySql query is too slow
  • Getting Registered App Display Name from an App Id
  • How to get all variables from a string
  • Delete entity with all childs connected
  • Azure Build agent cant´t find class library referance
  • Initialize Nested Dictionaries in c#
  • .Net Core Binding
  • Generic event test method, preventing code duplication
  • How do I keep the ellipses in the center when the screen is resized
  • How to require a property using JsonSchema.NET?
  • C# XDocument Element/Elements returns null
  • Autofac keyed service with IEnumerable relationship type
  • Installing EntityFramework via NuGet manager
  • Always Check if there is Internet Connection Xamarin forms
  • WCF OneWay service slows down when aspNetCompatibilityEnabled is set to false
  • Can we use JsonRequestBehavior.AllowGet with [HttpPost] attribute?
  • How to customize the Setup wizard with custom forms in Visual Studio setup project
  • C# ASP.NET - Use method from another class to create labels
  • C# List IList or IEnumerable as argument
  • Parsing File with C# And Replace method
  • Losing special unicode characters in encryption (C#)
  • Getting stored procedure returned value instead of row affected
  • How can I construct HTML using NameValuePair in android?
  • Loading a pop up page in ASP.net through a js file
  • How to pass alert or notification message from controller to View?
  • C# to pause, turn on ssas server, backup cube.... how to?
  • How to execute DataTable.Select() for a column of custom class type for a particular element in that C#
  • how to connect mysql8.0 with C#
  • Passing incorrect values into MultiValueConverter by MultiBinding
  • Can i use IEnumerator as Update func?
  • How to convert API Json response to C# Array?
  • Blazor Textfield Oninput User Typing Delay
  • Performing both layout and render transform results in wrong output
  • uwp beforetextchanged cursor moving in front of text
  • How to keep duplicates from a string[] exclude words from a List and print them out
  • .Net Core Strings.Asc/Mid/Chr/Len missing even after importing Microsoft.VisualBasic
  • How to return to previous search page without being asked to Confirm Form Re-submission and keeping the results on ASP.N
  • How set a identity scaffolding item/page how initial page in asp.net MVC core?
  • LINQ isn't calling Dispose on my IEnumerator when using Union and Select, expected behavior or bug?
  • What is "ByteArray.uncompress()" in AS3 equivalent to in C#?
  • Getting a specific letter from a string variable for my simple guessing game for clues
  • Send an email with Outlook without a subject --- dialog box issue
  • passing List<MyModel> from my controller in the "WebInterfaceProject" to the processor method in "D
  • How to convert Word document created from template by OpenXML into MemoryStream?
  • How can I make a single slider that changes the color of an object?
  • Remap JSON parameter in c#
  • What is the difference between "this ref" and "ref this" when talking about C# 7.2 ref extension met
  • Convert OpenSSL encryption into native C#
  • Accessing Properties in Razor Pages
  • How to get SOAP element value
  • Projection after Group
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com