Mar 18, 2012 at 9:08 PM


íf I use this within the WPF DataGrid, EndEdit fires if the popup is closing and bevore setting the value property ;-(

Any Idea?



Jun 18, 2012 at 8:22 PM

You can edit the source of Dameer class.
Put inside Initializ() the following:

this.Loaded += new RoutedEventHandler(Dameer_Loaded);
this._textBox.PreviewLostKeyboardFocus += new KeyboardFocusChangedEventHandler(Dameer_PreviewLostKeyboardFocus);

and add the following 2 methods:

void Dameer_Loaded(object sender, RoutedEventArgs e) { this._textBox.Focus(); }
void Dameer_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e){if(this._popUp.IsOpen) e.Handled=true; }

To see the dropdownbutton (textblock) inside a datagridcell modify the GetTemplate method as follows (the modified part is in red)


private ControlTemplate GetTemplate()
            return (ControlTemplate)XamlReader.Parse(@"
        <ControlTemplate  xmlns=""""
            <Border BorderBrush=""Black"" BorderThickness=""0"" CornerRadius=""1"">
                <StackPanel Orientation=""Horizontal"" VerticalAlignment=""Center"" HorizontalAlignment=""Left"" Background=""White"">
                    <CheckBox Name=""checkBox"" VerticalAlignment=""Center"" />
                    <TextBox Name=""textBox"" BorderThickness=""0""/>
                    <TextBlock Name=""textBlock"" Text=""▼"" Foreground=""Black""/>