last day (17 days later) » 

10:52 AM
4
A: Not able to organize data in DropDownButton

FunkInstead of trying to get the third party control to work, I'd alter the working ComboBox to suit your needs: MainWindow.xaml <Controls:MetroWindow x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mic...

 
Thanks for the time that you've dedicated. I've few question before accept your answer: 1. Is possible set a default text in the combobox independently from the selected item? 2. Is possible change the color of GroupBox text (I mean the country name color)? Thanks.
 
@AgainMe You're welcome, to answer your questions: 1. That's what the CombinedTemplate is for, it makes sure the default text stays fixed no matter what. 2. You can get blue country names setting the GroupHeader content to: <TextBlock Text="{Binding Name}" Margin="10,0,0,0" Foreground="Blue"/>
 
Thanks, I need to wait stackoverflow time limit to send you the bounty. Just one thing: I get no default text displayed in combobox unfortunately..
 
@AgainMe The default text is set in the HeaderTemplate. Note that the Ancestor in the DataTrigger Binding is now of type ComboBoxItem (instead of DropDownButton). If that doesn't help try replacing the xaml file in your linked project with the code I've posted.
 
I understood why not working. So when I start the app I've no text on the ComboBox, the same case if I check an item, the text only will appear if I select the item itself on the combox. Is not possible keep the text when the application run? I though to set selectedindex = 0 to fix this, but maybe you know another solution.
 
10:52 AM
@AgainMe You lost me, so you are not using the CombinedTemplate?
I think the easiest way for you to find the problem is to download a fresh copy of your linked solution. And change the code in the xaml file with the code I've posted as an answer. The default text will then be "Campionati" and will remain as long as the app runs. Most likely you've made a mistake implementing my code in your solution. As per what you're describing it seems the CombinedTemplate is not implemented at all.
 
Hi there, yes I'm using CombinedTemplate
I just replaced my code with your code
The result is the same
 
11:07 AM
Hi AgainMe, have you tried it with a fresh copy of the solution you linked?
 
You've updated the demo solution? I can't see any link
 
No, I meant your demo solution. The code I've posted should replace your MainWindow.xaml, so a select all and then paste my code.
 
Yes I've replaced all my code with your code
The only problem's that I get the text displayed only when I select a specific item in combobox
 
Strange, I get the text at startup and I'm not setting anything (SelectedXXX). You could switch to Rachel's Solution and abandon the CombinedTemplate. The benefit of her solution is that you get more control over the default text (styling), since it's not baked in in a template.
Here's another solution with Style.
 

  last day (17 days later) »