We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ComboboxAdv and CheckBox. SelectedItems don't work.

Thread ID:

Created:

Updated:

Platform:

Replies:

125602 Aug 26,2016 11:24 PM UTC Sep 1,2016 03:08 PM UTC WPF 5
loading
Tags: ComboBoxAdv
Konrad
Asked On August 26, 2016 11:24 PM UTC

Hello
I have a problem with CombobBox.
In my ComboBox I want have Items as CheckBox and text. I want use this solutin in WPF application with MVVM Light.

This is my code:

View:
            <syncfusion:ComboBoxAdv
                Margin="10,0,10,0"
                Grid.Column="0"
                Grid.ColumnSpan="3"
                FontSize="15"
                AllowMultiSelect="True"
                SelectedItems="{Binding SelectedDataGridColumns, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                ItemsSource="{Binding DataGridColumn, Mode=TwoWay}"/>
----------------------------------------------------------------------------------------------------------------------------------------------

ViewModel:
 public class ListUsersViewModel : ViewModelBase
 {
private ObservableCollection selectedDataGridColumns;

public ObservableCollection SelectedDataGridColumns
{
get { return selectedDataGridColumns; }
set
{
if (value.Count() != 0)
{
Set(ref selectedDataGridColumns, value);

ShowDataGridColumn(); // my method which sets the visibility of columns
}
}
}


private ObservableCollection dataGridColumn;

public ObservableCollection DataGridColumn
{
get { return dataGridColumn; }
set
{
Set(ref dataGridColumn, value);
}
}

public ListUsersViewModel()
{
            DataGridColumn = new ObservableCollection<string>()
            {
"a",
"b",
"c"
            };

            SelectedDataGridColumns = new ObservableCollection<object>()
            {
                "a",
                "c"
            }
}

public void ShowDataGridColumn()
{
  // When the SelectedDataGridColumns will be changing I want call the this method
}
}

----------------------------------------------------------------------------------------------------------------------------------------------

I set break Point in SelectedDataGridColumns (set) and run my application. 

SelectedDataGridColumns (set) is call twice:
1. When value.Count is = 2
2. When value.Count is = 0
and finaly SelectedDataGridColumns in ComboBox is 0 (This is ine problem)

A second problem:
When I selected item with ComboBox program go to SelectedDataGridColumns (set) and value = NULL
When I selected item second time with ComboBox program doing nothing,  don't enter to SelectedDataGridColumns (set)

This solution don't work, The same problems.
https://www.syncfusion.com/kb/5792/how-to-select-items-from-comboboxadv-control-at-startup

Pleace help me :)


Keerthana Jegannathan [Syncfusion]
Replied On August 29, 2016 12:45 PM UTC

Hi Konrad, 
 
Thank you for contacting Syncfusion support. 
 
In ComboBoxAdv, SelectedItems are binded as collection object. Hence, we request you to use the CollectionChanged event of the Binding source . This event is hooked after each update to the ComboBoxAdv. Please refer to the below code sample. 
 
 
Please let us know, if it helps. 
 
Regards, 
Keerthana J 


Konrad
Replied On August 30, 2016 10:12 AM UTC

This solution help me, Thank You :)

ButI have other problems

1. How can I change "DefaultText"? Default when I selected items "DefaultText" is a name selected items with Delimiter e.g. I selected "a" and "d". Now Default text is "a-d". I want to have a fixed text e.g. "Selected Items...".

2. How change text when in control I do AllowSelectAll="True" ? Default text is "Select all"

Thanks for help :)

Keerthana Jegannathan [Syncfusion]
Replied On August 31, 2016 10:20 AM UTC

Hi Konrad,   
   
In ComboBoxAdv, Default text gets displayed only when none of the item is selected. It is used to provide message before selecting the item. Once the item is selected then the default text will be cleared and selected item will get displayed. This is default behavior of the ComboBoxAdv. Can you share more information about your requirement and it would help to provide the solution at earliest?   
   
Regards,   
Keerthana J     


Konrad
Replied On August 31, 2016 12:23 PM UTC

Ok. Sorry for my English :)

This is image with show my problems:
https://s10.postimg.io/8yqab7cll/Bez_tytu_u.png

[1] - I solved this problem by modifying the style ComboBox Adv with this topic:
https://www.syncfusion.com/forums/125423/comboboxadv-change-background-when-i-want-select-item-and-when-i-clicked-on-comboboxadv

[2] - Sorry for the Polish name but my program is in Polish.  I want have "Selected items..." all time, regardless of whether I choose the item.

[3] - When I clic "select all" I have "Bacground=blue". How change this color, because style with topic:
https://www.syncfusion.com/forums/125423/comboboxadv-change-background-when-i-want-select-item-and-when-i-clicked-on-comboboxadv
don't include the background settings when I set "AllowSelectAll=True" in ComboBoxAdv in xaml file. I heave change color when I click "Select all" and when I invade muose, this is: 
IsPressed Trigger,
IsMouseOver Trigger,
IsChecked Trigger.

Regards, 
Konrad D 


Keerthana Jegannathan [Syncfusion]
Replied On September 1, 2016 03:08 PM UTC

Hi Konard, 
 
We have prepared sample in which we had updated the DefaultText on loading and when the ComboBoxAdv lost focus and also we have modified the text from in SelectAll to Select in App.Xaml file when binding content to the AllowSelectAll property.  
 
Currently we are preparing the sample for your remaining, we will update you the sample soon. 
 
Regards, 
Keerthana J 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;