Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
320
xamlcheckbox value change is not triggering during dock manager undock
posted

Hi Team,

XamCheckEditor_ValueChanged event is not triggering during docked window undock

xaml code - 

<Window x:Class="checkboxsample.MainWindow"
xmlns="">schemas.microsoft.com/.../presentation"
xmlns:x="">schemas.microsoft.com/.../xaml"
xmlns:d="">schemas.microsoft.com/.../2008"
xmlns:mc="">schemas.openxmlformats.org/.../2006"
xmlns:local="clr-namespace:checkboxsample"
xmlns:dockManager="">infragistics.com/DockManager"
xmlns:dataPresenter="">infragistics.com/DataPresenter"
xmlns:i="">schemas.microsoft.com/.../behaviors"
xmlns:xamEditors="">infragistics.com/Editors"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.DataContext>
<local:YourViewModel />
</Window.DataContext>
<Window.Resources>
<ResourceDictionary>
<Style TargetType="xamEditors:XamCheckEditor">
<EventSetter Event="ValueChanged" Handler="XamCheckEditor_ValueChanged"/>
</Style>
</ResourceDictionary>
</Window.Resources>
<StackPanel>
<TextBox></TextBox>
<dockManager:XamDockManager x:Name="dockManager"
Theme="IGTheme" ToolWindowLoaded="XamDockManager_ToolWindowLoaded" Height="174">
<dockManager:XamDockManager.Panes>
<dockManager:SplitPane dockManager:XamDockManager.InitialLocation="DockedRight"
SplitterOrientation="Horizontal"
MinWidth="420" Width="420" MaxWidth="420">
<dockManager:ContentPane Header="Terminations" Background="#F3F4F5"
CloseButtonVisibility="Collapsed"
WindowPositionMenuVisibility="Collapsed">
<dataPresenter:XamDataGrid x:Name="grid1"
DataSource="{Binding YourItemsSource}">
<dataPresenter:XamDataGrid.FieldLayouts>
<dataPresenter:FieldLayout>
<dataPresenter:FieldLayout.Fields>
<dataPresenter:UnboundField Name="Chk" Label="Check Box" BindingPath="Check">
<dataPresenter:UnboundField.Settings>
<dataPresenter:FieldSettings EditorType="{x:Type xamEditors:XamCheckEditor}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ValueChanged">
<i:InvokeCommandAction Command="{Binding Path=CheckCommand}" CommandParameter="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</dataPresenter:FieldSettings>
</dataPresenter:UnboundField.Settings>
</dataPresenter:UnboundField>
</dataPresenter:FieldLayout.Fields>
</dataPresenter:FieldLayout>
</dataPresenter:XamDataGrid.FieldLayouts>
</dataPresenter:XamDataGrid>
</dockManager:ContentPane>
</dockManager:SplitPane>
</dockManager:XamDockManager.Panes>
</dockManager:XamDockManager>
</StackPanel>
</Window>

MainWindow.xaml.cs 

using Infragistics.Windows.DataPresenter;
using Infragistics.Windows.Editors;
using System;
using System.Collections.Generic;
using System.Linq;
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;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Input;

namespace checkboxsample
{
public class YourDataType : INotifyPropertyChanged
{
private bool _check;
public bool Check
{
get => _check;
set
{
if (_check != value)
{
_check = value;
OnPropertyChanged(nameof(Check));
}
}
}

public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

public class YourViewModel : INotifyPropertyChanged
{
private ObservableCollection<YourDataType> _yourItemsSource;

public YourViewModel()
{
YourItemsSource = new ObservableCollection<YourDataType>
{
new YourDataType { Check = false },
new YourDataType { Check = true }
};
}

public ObservableCollection<YourDataType> YourItemsSource
{
get => _yourItemsSource;
set
{
_yourItemsSource = value;
OnPropertyChanged(nameof(YourItemsSource));
}
}

public ICommand CheckCommand => new RelayCommand<YourDataType>(ExecuteCheckCommand);

private void ExecuteCheckCommand(YourDataType item)
{
// Your command logic here
item.Check = !item.Check; // Toggle the checkbox state
}

public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = new YourViewModel();
}

public void XamDockManager_ToolWindowLoaded(object sender, Infragistics.Windows.DockManager.Events.PaneToolWindowEventArgs e)
{

}

private void XamCheckEditor_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
}
}
}

  • 7535
    Offline posted

    Hello ,

    Thank you for contacting . Are you getting any binding error ?Also you created support for v12.2 which is no longer supported and bug fix , so may i know if thats the version you are using ? If so then may be there was an issue with the older version , which is fixed with the latest supported version , so i would like you to download the trial and test the sample against latest V24.1.

    Or share your runnable sample so i can test it with the latest and see if issue still exist or fixed. If its fixed then you would have to upgrade to latest version, in order to get the fix.

    Also here i attached the sample i created using your code ,and getting error ,so may be you can modify the code and attach it back  for further investigation.

    5611.WpfApp3.zip