Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all 4964 articles
Browse latest View live

New Post: CheckComboBox selectedItems

$
0
0
Actually, it's not just the 1st time. It keeps not calling CheckComboBox's Command Property's Bound ICommand (OnUserGroupTypeToggledCommand) until I actually toggle an item in the CheckComboBox via the UI. I don't know if this makes a difference but here are a few differences between yours and my code:
  1. My SelectedItemsOverride's Bound Property's Backing Variable (selectedUserGroupTypesOverride) is initialized to an empty ObservableCollection<UserGroupType> at the View Model's Class level first.
  2. I have an "All" Checkbox whose IsChecked Property I set to true in the Window's Loaded Event Handler which results in calling the Setter of its Bound Property (UserGroupTypesAllChecked). That Setter first calls SelectedItemsOverride's Bound Property (SelectedUserGroupTypesOverride)'s Clear Method (which, btw, does Raise the Backing Variable (selectedUserGroupTypesOverride)'s CollectionChanged Event with an NotifyCollectionChangedEventArgs.Action of Reset). That Clear Method, as expected, doesn't result in a call to OnUserGroupTypeToggledCommand, because prior to the Clear Method call (after the first time I set the "All" Checkbox's IsChecked to true), no items were selected.
  3. However, when I subsequently call SelectedItemsOverride's Bound Property (SelectedUserGroupTypesOverride)'s Add Method to add each of all possible items each call to which I would've expected to result in a call to OnUserGroupTypeToggledCommand, it doesn't (even after repeated toggling of "All" Checkbox via the U.I.) - UNTIL I actually toggle an item off / on in the CheckComboBox via the UI!?! Afterwards, the OnUserGroupTypeToggledCommand gets called as expected for every single item whenever I toggle the "All" Checkbox on/off in the U.I..

Created Unassigned: Can't select another item in CollectionControl after focusing property editor [22525]

$
0
0
After focusing a property's editor in the PropertyGrid control of a CollectionControl and attempting to click on another item in the listbox (PART_ListBox), it will stay on the on the current item until you click again.

Steps to reproduce:
1. Add this class: `public class MyClass { public string MyString { get; set; } }`
2. Add a CollectionControl with an ItemsSource containing two `MyClass`
3. Select first `MyClass` and edit the `MyString` property
4. Try to select the second `MyClass`

It will refresh the listbox and stay on the first class until you click again.

Commented Unassigned: Add "duplicate" button to CollectionControl [22486]

$
0
0
Suggestion: Add a button to the CollectionControl that duplicates (create new item and copy all properties) the current item and places it below it in the list.

Example image:
![Image](http://i.imgur.com/qN1j9pp.jpg)

Hope you consider this.
Thanks!
Comments: ** Comment from web user: omsed **

I completely messed up the original question. Sorry!

I've edited the original post to specify what I actually meant.

New Post: CheckComboBox selectedItems

$
0
0
Hi,

Can you attach a sample (or modify the one I've copied in this post) so I could reproduce it the same way as you ? Maybe it's just an initialization problem or the way you are updating the SelectedItemsOverride's Bound Property.

Thanks.
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF

Edited Issue: Can't select another item in CollectionControl after focusing property editor [22525]

$
0
0
After focusing a property's editor in the PropertyGrid control of a CollectionControl and attempting to click on another item in the listbox (PART_ListBox), it will stay on the on the current item until you click again.

Steps to reproduce:
1. Add this class: `public class MyClass { public string MyString { get; set; } }`
2. Add a CollectionControl with an ItemsSource containing two `MyClass`
3. Select first `MyClass` and edit the `MyString` property
4. Try to select the second `MyClass`

It will refresh the listbox (PART_ListBox) and stay on the first `MyClass` until you click again.


Tested with Community Edition version 3.0.0.
Comments: ** Comment from web user: BoucherS **

Hi,

This will be fixed in v3.4.

――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_


New Post: CheckComboBox selectedItems

$
0
0
BoucherS: Please see my ".Xaml" and ".Xaml.Cs" code samples below and the 3 occurrences of the Comment that says: "//!!!WARNING!!!: The following Statement does NOT result in "OnUserGroupTypeToggled" being called!?!".
<Window x:Class="TestXceedCheckedComboBoxWpfApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:TestXceedCheckedComboBoxWpfApp"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"      
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525"
    >
    <StackPanel>
        <xctk:CheckComboBox x:Name="UserGroupsTypesCheckedComboBox"
            ItemsSource="{Binding UserGroupTypes}"
            SelectedItemsOverride="{Binding SelectedUserGroupTypesOverride}"
            DisplayMemberPath="Name"
            Command="{Binding OnUserGroupTypeToggledCommand}"
            ValueMemberPath="ID" 
        />

        <StackPanel Margin="0,200,0,0"
            Orientation="Horizontal">
            <TextBlock Text="SelectedItems: " />
            <TextBlock Text="{Binding SelectedItemsOverride.Count, ElementName=UserGroupsCheckedComboBox}" />
        
        </StackPanel>

        <CheckBox Name="UserGroupTypesAllCheckBox"
            IsChecked="{Binding UserGroupTypesAllChecked}"
            VerticalAlignment="Center"
            >
            All
        </CheckBox>

    </StackPanel>
</Window>
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TestXceedCheckedComboBoxWpfApp
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, INotifyPropertyChanged
    {

        private List<UserGroupType> userGroupTypes;
        private ObservableCollection<UserGroupType> selectedUserGroupTypesOverride = new ObservableCollection<UserGroupType>();
        private bool userGroupTypesAllChecked;

        public event PropertyChangedEventHandler PropertyChanged;

        public MainWindow()
        {
            InitializeComponent();

            this.Loaded += MainWindow_Loaded;
            this.UserGroupTypes = new List<UserGroupType>()
              {
                new UserGroupType() { ID = 1, Name = "First" },
                new UserGroupType() { ID = 2, Name = "Second" },
                new UserGroupType() { ID = 3, Name = "Third" },
                new UserGroupType() { ID = 4, Name = "Fourth" },
                new UserGroupType() { ID = 5, Name = "Fifth" },
              };
            this.DataContext = this;

            //!!!WARNING!!!: The following Statement does NOT result in "OnUserGroupTypeToggled" being called!?!
            this.SelectedUserGroupTypesOverride = new ObservableCollection<UserGroupType>() { this.UserGroupTypes[0] };
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //!!!WARNING!!!: The following Statement does NOT result in "OnUserGroupTypeToggled" being called!?!
            this.SelectedUserGroupTypesOverride = new ObservableCollection<UserGroupType>() { this.UserGroupTypes[1] };

            //!!!WARNING!!!: The following Statement does NOT result in "OnUserGroupTypeToggled" being called - 
            //  UNTIL an item is toggled on/off via the U.I.!?!
            this.UserGroupTypesAllCheckBox.IsChecked = true;
        }

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        public ICommand _OnUserGroupTypeToggled { get; private set; }
        public ICommand OnUserGroupTypeToggledCommand
        {
            get
            {
                return _OnUserGroupTypeToggled
                ??
                (
                    _OnUserGroupTypeToggled =
                    (
                        new RelayCommand(execute: OnUserGroupTypeToggled)
                    )
                );
            }
        }

        public List<UserGroupType> UserGroupTypes
        {
            get
            {
                return userGroupTypes;
            }
            set
            {
                if (userGroupTypes != value)
                {
                    userGroupTypes = value;
                    OnPropertyChanged();
                }
            }
        }

        public bool UserGroupTypesAllChecked
        {
            get
            {
                return userGroupTypesAllChecked;
            }
            set
            {

                if (userGroupTypesAllChecked != value)
                {

                    userGroupTypesAllChecked = value;

                    // BEGIN Force select / clear all UserGroupTypes depending on whether userGroupTypesAllChecked is true.

                    // Build new empty (AllChecked = false) / full (AllChecked = true) selected items list in a temporary Collection
                    //  to avoid the normal ObservableCollection notifying the View until all changes are made.
                    var tempSelectedUserGroupTypes = new ObservableCollection<UserGroupType>();
                    if (userGroupTypesAllChecked == true)
                    {
                        UserGroupTypes.ForEach(ug => tempSelectedUserGroupTypes.Add(ug));
                    }
                    SelectedUserGroupTypesOverride = tempSelectedUserGroupTypes;

                    // END Force select / clear all UserGroupTypes depending on whether userGroupTypesAllChecked is true.

                    //OnPropertyChanged();

                } // if (userGroupTypesAllChecked != value)

            } // set
        }

        public ObservableCollection<UserGroupType> SelectedUserGroupTypesOverride
        {
            get
            {
                return selectedUserGroupTypesOverride;
            }
            set
            {
                if (selectedUserGroupTypesOverride != value)
                {
                    selectedUserGroupTypesOverride = value;
                    OnPropertyChanged();
                }
            }
        }

        public void OnUserGroupTypeToggled(object parameter)
        {
            System.Diagnostics.Debug.WriteLine("OnUserGroupTypeToggled.");

            var selectedUserGroupType = (UserGroupType)parameter;

            if (selectedUserGroupTypesOverride.Count < userGroupTypes.Count)
            {
                // Change the Backing Variable vs. the Bound Property, so its Setter won't clear all selections.  
                userGroupTypesAllChecked = false;
                // Notify View so it'll clear the checkbox.
                OnPropertyChanged(propertyName: nameof(UserGroupTypesAllChecked));
            }
            else if (selectedUserGroupTypesOverride.Count == userGroupTypes.Count)
            {
                // Change the Backing Variable vs. the Bound Property, so its Setter won't clear all selections.  
                userGroupTypesAllChecked = true;
                // Notify View so it'll clear the checkbox.
                OnPropertyChanged(propertyName: nameof(UserGroupTypesAllChecked));
            }
        }
    }

    public class UserGroupType
    {
        public string Name
        {
            get;
            set;
        }

        public int ID
        {
            get;
            set;
        }
    }


    public class RelayCommand : ICommand
    {
        #region Fields 
        readonly Action<object> _execute;
        readonly Predicate<object> _canExecute;
        #endregion // Fields 
        #region Constructors 
        public RelayCommand(Action<object> execute) : this(execute, null) { }
        public RelayCommand(Action<object> execute, Predicate<object> canExecute)
        {
            if (execute == null)
                throw new ArgumentNullException(nameof(execute));
            if (canExecute == null)
                throw new ArgumentNullException(nameof(canExecute));
            _execute = execute;
            _canExecute = canExecute;
        }
        #endregion // Constructors 
        #region ICommand Members 
        [DebuggerStepThrough]
        public bool CanExecute(object parameter)
        {
            return _canExecute == null ? true : _canExecute(parameter);
        }
        public event EventHandler CanExecuteChanged
        {
            add
            {
                CommandManager.RequerySuggested += value;
            }
            remove
            {
                CommandManager.RequerySuggested -= value;
            }
        }
        public void Execute(object parameter)
        {
            _execute(parameter);
        }
        #endregion // ICommand Members 
    }
}

New Post: CheckComboBox selectedItems

$
0
0
Also, CheckedComboBox.ItemSelectionChanged Event is not being Raised if the items are being toggled via CheckedComboBox.SelectedUserGroupTypesOverride vs. the U.I.

Edited Feature: Add "duplicate" button to CollectionControl [22486]

$
0
0
Suggestion:
Add a button to the CollectionControl that duplicates (create new item and copy all properties) the current item and places it below the original in the list.

Example:
![CollectionControl new "duplicate" button](http://i.imgur.com/qN1j9pp.jpg)

Hope you consider this.
Thanks!
Comments: ** Comment from web user: BoucherS **

Hi,

This will be include in v3.4.
Thanks.

――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_


New Post: PropertyGrid DataTemplate breaks binding

$
0
0
When I create a DataTemplate to customize a built-in editor it breaks the data binding.
Given:
class Fluid : ObservableObject //INotifyProperty implementation
{
    [Category("Display")]
    [DisplayName("Fill Color")]
    [Editor(typeof(ColorEditor), typeof(ColorEditor))]
    public Color Fill { 
        get { return _fill; } 
        set { Set(ref _fill, value); }
    }
}
and the following XAML:
<xctk:PropertyGrid.EditorDefinitions>
    <xctk:EditorTemplateDefinition> <!-- TargetProperties="Fill,Border"> -->
        <xctk:EditorTemplateDefinition.TargetProperties>
            <xctk:TargetPropertyType Type="{x:Type m:Color}" />
        </xctk:EditorTemplateDefinition.TargetProperties>
        <xctk:EditorTemplateDefinition.EditingTemplate>
            <DataTemplate>
                <xctk:PropertyGridEditorColorPicker DisplayColorAndName="False"/>
            </DataTemplate>
        </xctk:EditorTemplateDefinition.EditingTemplate>
    </xctk:EditorTemplateDefinition>
</xctk:PropertyGrid.EditorDefinitions>
where m is the System.Windows.Media namespace.

If I add the EditorAttribute to the Fill property the binding works, but the xaml DataTemplate is ignored. If I remove the EditorAttribute the binding is broken, but the DataTemplate is used.

As you can see, in the DataTemplate I have tried both the Color type target as well as the Fill property target, with the same results.

I must be missing something simple.
Thanks, John

Created Unassigned: TimePicker input issue [22526]

$
0
0
There is a problem when entering minutes into TimePicker.
TimePicker allows you to enter only the first digit of the minute.
The second digit can only be entered if you enter the same digit twice.
An example in gif.
The order of input: 1, 2, 3, 4, 5, 6, 1, 1, 2.

New Post: CheckComboBox selectedItems

$
0
0
Hi,

You are right, the OnUserGroupTypeToggled() Command won't be executed at the 3 lines where your comment says "//!!!WARNING!!!".
This is because you are modifying the the SelectedUserGroupTypesOverride property, on which the CheckComboBox.SelectedItemsOverride is bound.
When modifying the CheckComboBox.SelectedItemsOverride property, a new collection of selectedItems is set.

Currently, the only times the CheckComboBox.Command will be executed, is when an item selection is changed. This means when the CheckComboBox popup has been opened (its item containers were created) and a checkBox from the CheckComboBox raises its "Selected" or "UnSelected" event.

If modifying CheckComboBox.SelectedItemsOverride while the CheckComboBox was never opened, you won't have the Command executed.

This will all be fixed in v3.4.
In this version, modifying the SelectedItemsOverride property will raise the Command for every affect item, as well as selecting/unselecting items.


――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF

Created Issue: CheckComboBox : Command not raised if popup not opened [22527]

$
0
0
Based on codeplex issue https://wpftoolkit.codeplex.com/discussions/662425.

Edited Issue: CheckComboBox : Command not raised if popup not opened [22527]

$
0
0
Based on codeplex issue https://wpftoolkit.codeplex.com/discussions/662425.

Commented Issue: CheckComboBox : Command not raised if popup not opened [22527]

$
0
0
Based on codeplex issue https://wpftoolkit.codeplex.com/discussions/662425.
Comments: ** Comment from web user: BoucherS **

This will be fixed in v3.4.

――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_

New Post: CheckComboBox selectedItems


New Post: CheckComboBox selectedItems

$
0
0
Ah-HA! GOT one! ;) Seriously, thank you and your company for confirming the issue and agreeing to fix it.
  1. So, I presume this is also what's causing "CheckComboBox.ItemSelectionChanged Event is not being Raised if (SelectedItemsOverride modified before drop-down has been opened)" (see my 5/1/17 2:22 pm comment)?
  2. So, I presume the workaround is to "Handle the (SelectedItemsOverride's Bound aka Source ObservableCollection Property's) Backing Variable's "CollectionChanged" Event"?

New Post: PropertyGrid DataTemplate breaks binding

$
0
0
So, the key to this is this sentence in the Custom Editors with DataTemplates section of the documentation:
Be sure to bind your custom editor to the bound property item's Value property.
It took me a while to decipher what that meant, but here is the added code that make the binding work with a ColorEditor in a DataTemplate:
<DataTemplate>
    <xctk:PropertyGridEditorColorPicker DisplayColorAndName="False" SelectedColor="{Binding Value}"/>
</DataTemplate>

New Post: CheckComboBox selectedItems

$
0
0
Hi,
  1. Yes, the CheckComboBox.ItemSelectionChanged event is currently only raised when the drop-down has been opened. It will be fixed in v3.4 along with the Command property raising.
  2. Yes a workaround can be
    a) add a handler for CheckComboBox.SelectedItems.CollectionChanged (if the CheckComboBox.SelectedItemsOverride will no longer be modified) :
( ( ObservableCollection<UserGroupType> )UserGroupsTypesCheckedComboBox.SelectedItems ).CollectionChanged += MainWindow_CollectionChanged
b) add a handler of CollectionChanged for your bound variable to CheckComboBox.SelectedItemsOverride (if you are modifying the CheckComboBox.SelectedItems via your bound variable to CheckComboBox.SelectedItemsOverride ) :
tempSelectedUserGroupTypes.CollectionChanged += TempSelectedUserGroupTypes_CollectionChanged;
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF

Commented Unassigned: TimePicker input issue [22526]

$
0
0
There is a problem when entering minutes into TimePicker.
TimePicker allows you to enter only the first digit of the minute.
The second digit can only be entered if you enter the same digit twice.
An example in gif.
The order of input: 1, 2, 3, 4, 5, 6, 1, 1, 2.
Comments: ** Comment from web user: BoucherS **

Hi,

This should be fixed in v3.1.

――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_

New Post: DataGridControl - Formatting Auto-Generated DateTime? Column

$
0
0
How do I change the format used to display a DateTime? Columns' Bound / Source Property of a DataGridControl Bound to an ObservableCollection<MyItemClass>?

I've tried, in the Window.Loaded Event Handler, for the applicable Column, setting its:
  1. CellContentStringFormat (to "ddd MM/dd/yy hh:mm tt") which resulted in the literal "ddd MM/dd/yy hh:mm tt" (without the quotes) being displayed in all Rows.
  2. DisplayedValueConverter to an IValueConverter that "Convert"(s) a DateTime? to a String of Format "ddd MM/dd/yy hh:mm tt".
Viewing all 4964 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>