Hi
I am trying to use xamComboEditor. In my main project the items have a white foreground and background colour, unless I mouse over the item - in which case I can see the text. Otherwise it just looks blank.
In a stand alone project I can get it too work?
I have tried to apply themes and it still doesnt work?
I cant find anything that would clash with it.
Please help
Chris
code behind binds to dataset then....
this.itemsProvider1.DisplayMemberPath = "Desc";this.itemsProvider1.ValuePath = "ID";
So just to be clear, the text within the items in the dropdown are not visible until you mouse over them. If so then it sounds like the Foreground property is the same as the Background property. The xamComboEditor contains a ComboBox in its EditTemplate and it is that combobox that provides the dropdown. The ComboBox creates a ComboBoxItem for each item in the list. We do not provide a custom style for that class so maybe you have a Style for that class in the ancestor chain that is providing the Foreground/Background that is being used. Without a sample I cannot say what is specifically leading to the problem so you would likely need to run something like Snoop and inspect the tree to see where the values for the Foreground/Background are coming from.
Thanks Andrew. That is what I meant foreground and background same colour for items. To make matters worse the only WPF program that snoop doesnt work on is the one I need it too. Its built upon a large codeplex project.
Is there any way that I can style the ComboBoxItem so that it doesnt inherit? Do you a small example? Im pretty desperate to get over this before saturday so i can get on with the project ;$
Hi Andrew
I have this style, its crappy but good example. I can work on it. Do you know how I can change to be applied globally so to speak - I mean like put into a page.resources or a resource dictonary. I cant repeat on each combo would be bad programming but when i put into page resources i get error?
Thanks in advance. Just trying to safe time. best to ask the guru's
<igEditors:XamComboEditor.ComboBoxStyle> <Style TargetType="ComboBox"> <Style.Resources> <AlternationConverter x:Key="BackgroundConverter"> <SolidColorBrush Color="Blue" /> <SolidColorBrush Color="Red" /> </AlternationConverter> <Style TargetType="ComboBoxItem" x:Key="alternatingItem"> <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=(ItemsControl.AlternationIndex), Converter={StaticResource BackgroundConverter}}"/> </Style> </Style.Resources> <Setter Property="ItemContainerStyle" Value="{StaticResource alternatingItem}" /> <Setter Property="AlternationCount" Value="2" /> </Style> </igEditors:XamComboEditor.ComboBoxStyle>
Sorry for being annoying I just dont want to waste your time. I guess my question is how can I use something like above but just to change background and foreground color, so scrap the alternating. And change it so i can put in page.resources or better resource dictionary, and easily apply across all my combos?
Whether you can do this at the page/app/window resources level will depend on whether the elements already have a local style. If they do (e.g. because you set the Theme property) or because there is another local style "closer" to the element then you may not be able to. If that isn't the case then you could possibly do something like:
I worked out how to clear the text, so it looks to the user there is nothing selected. Cheers
Sorry to be annoying more info though to save time. The selected index changes to -1, however the display text does not update to display blank? I guess thats the problem...
Thanks
Oh yeahI have tried this
this.cboSomething.SelectedIndex = -1;
Thanks for your help on that one. have struggled to find the clash but can work it on the window resources.
Do you know how i can reset the combo box to display without a selectedItem? I have a master detail layout, I wish to change the combo back to default empty and then re-bind the data, so if no selected value for new record the combo doesnt maintain its previous state?
Thanks in advance