Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 02:29

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[WPF] Editable ComboBox with context menu

Discussion on [WPF] Editable ComboBox with context menu within the .NET Languages forum part of the Coders Den category.

Closed Thread
 
Old   #1

 
Obilee's Avatar
 
elite*gold: 11
Join Date: May 2007
Posts: 62,452
Received Thanks: 29,520
[WPF] Editable ComboBox with context menu

I implemented a editable combobox with wpf:

Code:
 <ComboBox IsEditable="True">
                <ComboBoxItem Content="Item1"></ComboBoxItem>
                <ComboBoxItem Content="Item2"></ComboBoxItem>
</ComboBox>
and it works fine, but now i want to add my own context menu:

Code:
<ComboBox IsEditable="True" ContextMenu="{StaticResource contextMenu}">
and here is my problem: the comobox shows the editable contextmenu with copy, paste, cut and not my own declared one.

do somebody know how to avoid that my context menu is overwritten?
Obilee is offline  
Old 08/31/2012, 14:29   #2
 
elite*gold: 2
Join Date: Aug 2012
Posts: 457
Received Thanks: 604
PHP Code:
<ComboBox IsEditable="True" ContextMenuService.ShowOnDisabled="True">
    <
ComboBoxItem Content="Item1"></ComboBoxItem>
    <
ComboBoxItem Content="Item2"></ComboBoxItem>
</
ComboBox
Lu​ is offline  
Thanks
1 User
Old 08/31/2012, 14:51   #3

 
Obilee's Avatar
 
elite*gold: 11
Join Date: May 2007
Posts: 62,452
Received Thanks: 29,520
Code:
<ComboBox IsEditable="True" ContextMenuService.ShowOnDisabled="True">
            <ComboBox.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="test"></MenuItem>
                </ContextMenu>
            </ComboBox.ContextMenu>
            <ComboBoxItem Content="Item1"></ComboBoxItem>
            <ComboBoxItem Content="Item2"></ComboBoxItem>
        </ComboBox>
still the "cut/paste/copy" context menu visible and not my "test" context meu.
you can only see it if you right click on a select able combobox item, but i want this menu in the editable field of the context menu
Obilee is offline  
Old 08/31/2012, 15:00   #4
 
elite*gold: 2
Join Date: Aug 2012
Posts: 457
Received Thanks: 604
Also so geht es bei mir
Lu​ is offline  
Old 08/31/2012, 15:09   #5

 
Obilee's Avatar
 
elite*gold: 11
Join Date: May 2007
Posts: 62,452
Received Thanks: 29,520
du hast aber in deinem beispiel auch kein "IsEditable="True"" drinne wenn ich eine normale combobox mache geht es auch ohne probleme
Obilee is offline  
Old 08/31/2012, 15:19   #6
 
elite*gold: 2
Join Date: Aug 2012
Posts: 457
Received Thanks: 604
Ah jetzt weiß ich was du meinst.


PHP Code:
        <ComboBox HorizontalAlignment="Left" Height="28" Margin="10,10,0,0" Width="296" IsEditable="True" ContextMenuService.ShowOnDisabled="True" Name="combobox" Loaded="combobox_Loaded">
            <
ComboBox.ContextMenu>
                <
ContextMenu>
                    <
MenuItem Header="test"></MenuItem>
                </
ContextMenu>
            </
ComboBox.ContextMenu>
            <
ComboBoxItem Content="Item1"></ComboBoxItem>
            <
ComboBoxItem Content="Item2"></ComboBoxItem>
        </
ComboBox
PHP Code:
        private void combobox_Loaded(object senderRoutedEventArgs e)
        {
            (
VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(combobox0), 2) as TextBox).ContextMenu combobox.ContextMenu;
        } 
Lu​ is offline  
Thanks
1 User
Old 08/31/2012, 15:24   #7

 
Obilee's Avatar
 
elite*gold: 11
Join Date: May 2007
Posts: 62,452
Received Thanks: 29,520
Hab schon befürchtet dass ich das Textfeld überladen muss. Thx soweit.
Obilee is offline  
Closed Thread


Similar Threads Similar Threads
Context Menu Frage
09/22/2010 - General Coding - 6 Replies
Gibt es die Möglichkeit das Context Menü in der Adressleiste zu ändern? ;> Also rechtsklick auf die Adresse im Browser da hät ich gern einen eigenen Eintrag leider kann ich dazu nichts finden im Internet. Am besten wärs wenn es mit jedem Browser funktioniert ansonsten reicht auch firefox. Oder muss ich da unbedingt ein firefox addon schreiben wenn ich context menü einträge innerhalb von Firefox ändern will?
Editable web release
09/16/2009 - CO2 PServer Guides & Releases - 14 Replies
Well this website release is so people with no html/php coding expiriance can be able to edit it more.. this is a easier editable version from http://www.elitepvpers.com/forum/co2-pserver-discus sions-questions/324318-green-website.html TO SEE HOW THE WEBSITE LOOKS GO TO! Your Co Gamin <-- see it its nice every text u can see is editable ;O sorry i know the bg colors dont match xD - cudnt find the rite one ;O TO DOWNLOAD BELOW HERE
The name 'Face' does not exist in the current context!?
07/13/2009 - CO2 Private Server - 3 Replies
Alright, i'm new at this. I'm trying to add an NPC dialog, and it keeps telling me that the name 'Face' does not exist in the current context! What do I do?
Mandarks TServer0919c context
11/06/2007 - SRO Hacks, Bots, Cheats & Exploits - 7 Replies
nvm i found someone who made it better than me ;) go there and you will find everything you need ! http://www.elitepvpers.com/forum/sro-exploits-hack s-bots-guides/100001-full-install-video-tbot0919-c rack0919c.html



All times are GMT +2. The time now is 02:29.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.