-
Re. ItemSelectionChanged: Ok, thx!
-
Re. workaround: Ok, thx!
New Post: CheckComboBox selectedItems
New Post: DataGridControl - Formatting Auto-Generated DateTime? Column
Your second option almost works. Here's how I would use it :
Use a column with a CellContentTemplate :
<xcdg:Column FieldName="OrderDate"
Title="Order Date"
Width="120"
CellContentTemplate="{StaticResource DateDataTemplate}" />
The DataTemplate would use a DateConverter :<view:DisplayedValueConverter x:Key="DisplayedValueConverter" />
<DataTemplate x:Key="DateDataTemplate">
<TextBlock Text="{Binding Converter={StaticResource DisplayedValueConverter} }" />
</DataTemplate>
And the DateConverter would use the DateTime.ToString() method to convert the date : public class DisplayedValueConverter : IValueConverter
{
#region IValueConverter Members
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
{
if( value == null )
return null;
System.DateTime dateTime = ( System.DateTime )value;
return dateTime.ToString( "ddd MM/ dd / yy hh:mm tt" );
}
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
{
throw new NotImplementedException();
}
#endregion
}
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
Created Unassigned: CollectionControl NewItemTypes display names [22528]
New Post: CollectionControl NewItemTypes display names
issue https://wpftoolkit.codeplex.com/workitem/22528 has been created.
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
Edited Issue: CollectionControl NewItemTypes display names [22528]
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: DataGridControl - Formatting Auto-Generated DateTime? Column
-
Where do a I place the "xcdg:Column" Element? If I place it inside the "xcdg:DataGridControl" Element, I get an error saying "Items collection must be empty before using ItemsSource." when I call Window.Show.
-
a. With .NET's DataGrid, all I have to do is Handle the AutoGeneratingColumn Event and for each "e.Column.SortMemberPath == nameof(MyItemClass.MyDateTime)" set "((System.Windows.Data.Binding)((System.Windows.Controls.DataGridBoundColumn)e.Column).Binding).StringFormat" = "ddd MM/ dd / yy hh:mm tt" (e.g. without having to, in XAML, hard-code a Column's Bound Source Property Name and the Column's Width). Is your solution the closest DataGridControl equivalent to that? b. What does DataGridControl not have a AutoGeneratingColumn Event?
-
When / how would one, in Code Behind vs. XAML, use the CellContentStringFormat Property?
-
When / how would one, in Code Behind vs. XAML, use the DisplayedValueConverter Property?
New Post: DataGridControl - Formatting Auto-Generated DateTime? Column
- "xcdg:Column" goes in the DataGridControl's Columns collection, ex :
<xcdg:DataGridControl x:Name="_dataGrid"
ItemsSource="{Binding Source={StaticResource cvsOrders}}" >
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="OrderID"
Title="Order"
Width="100"
IsMainColumn="True">
</xcdg:Column>
<xcdg:Column FieldName="OrderDate"
Title="Order Date"
Width="120"
CellContentTemplate="{StaticResource DateDataTemplate}" />
<xcdg:Column FieldName="ShipRegion"
Visible="False" />
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
-
In the DataGridControl, you don't need to define all columns individually. If you don't, they will have a default width and look. You could set the AutoCreateColumns to False and only define the columns you want to see and apply specific configuration on them. We don't see the need in our design to have an equivalent to Microsoft AutoGeneratingColumn event. The binding can be done in XAML for each column.
-
You can try with to use the CellContentStringFormat on a Column to format your date in xaml :
<xcdg:Column FieldName="OrderDate"
Title="Order Date"
Width="120"
CellContentStringFormat="{}{0:ddd MM/ dd / yy hh:mm tt}"/>
or in code-behind : _dataGrid.Columns[ "OrderDate" ].CellContentStringFormat = "{0:ddd MM/ dd / yy hh:mm tt}";
You can use XAML or code-behind for this, it's the same look.- You can try with to use the CellContentTemplate on a Column to format your date in xaml as shown earlier.
Or in code-behind with Resources defined in XAML:
_dataGrid.Columns[ "OrderDate" ].CellContentTemplate = this.Resources[ "DateDataTemplate" ] as DataTemplate;
or in full code-behind: var dataTemplate = new DataTemplate();
var date = new FrameworkElementFactory( typeof( TextBlock ) );
date.SetBinding( TextBlock.TextProperty, new Binding( "." ) { Converter = new DisplayedValueConverter() } );
dataTemplate.VisualTree = date;
_dataGrid.Columns[ "OrderDate" ].CellContentTemplate = dataTemplate;
XAML is simpler to use for DataTemplates and bindings. For your situation, using the CellContentStringFormat is easier.
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
New Post: What's happening to the Toolkit with CodePlex being shut down?
New Post: What's happening to the Toolkit with CodePlex being shut down?
We are planing on moving the Toolkit on GitHub in the following weeks. Everything will be announced.
Thanks.
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
Created Unassigned: AvalonDock: Can't add new LayoutDocuments to a LayoutDocumentPane after deserializing [22529]
Simple repro follows. Using the "Add new tab" button will stop working after clicking the "Deserialize" button. Even if re-serializing and deserializing, the new tabs are not visible.
Repro XAML:
```
<Window x:Class="AvalonDockTabsTest2.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:AvalonDockTabsTest2"
xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Orientation="Horizontal">
<Button Content="Add new tab"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="4"
Click="OnAddTabClick" />
<Button Content="Serialize"
Margin="4"
Click="OnSerialize" />
<Button Content="Deserialize"
Margin="4"
Click="OnDeserialize" />
</StackPanel>
<xcad:DockingManager Grid.Row="1" x:Name="DockingManager">
<xcad:LayoutRoot>
<xcad:LayoutPanel>
<xcad:LayoutDocumentPaneGroup>
<xcad:LayoutDocumentPane x:Name="DocPane">
<xcad:LayoutDocument Title="Default" CanClose="False" />
</xcad:LayoutDocumentPane>
</xcad:LayoutDocumentPaneGroup>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
</Grid>
</Window>
```
Repro code-behind:
```
namespace AvalonDockTabsTest2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private int count;
private string serializedLayout;
public MainWindow()
{
this.InitializeComponent();
}
private void OnAddTabClick(object sender, RoutedEventArgs e)
{
LayoutDocument doc = new LayoutDocument();
doc.Title = "test " + this.count;
doc.ContentId = "test" + this.count;
doc.Content = new Grid();
++this.count;
this.DocPane.Children.Add(doc);
}
private void OnDeserialize(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(this.serializedLayout))
{
this.OnSerialize(null, null);
}
XmlLayoutSerializer serializer = new XmlLayoutSerializer(this.DockingManager);
using (StringReader sr = new StringReader(this.serializedLayout))
{
XmlReader xr = XmlReader.Create(sr);
serializer.Deserialize(xr);
}
}
private void OnSerialize(object sender, RoutedEventArgs e)
{
XmlLayoutSerializer serializer = new XmlLayoutSerializer(this.DockingManager);
using (MemoryStream ms = new MemoryStream())
{
serializer.Serialize(ms);
this.serializedLayout = Encoding.ASCII.GetString(ms.ToArray());
}
}
}
}
```
Created Unassigned: AvalonDock: If you close a document tab before it has been made visible, application will crash with a NullReferenceException [22530]
Use "add new tab" to add new tabs
Click "close" button **without clicking on the new tab to make it visible**. Application will crash with a NullReferenceException. If you click on the tab at least once to give it visibility, this doesn't appear to reproduce.
This is the stack:
```
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.get_View()
at Xceed.Wpf.AvalonDock.DockingManager.RemoveViewFromLogicalChild(LayoutContent layoutContent)
at Xceed.Wpf.AvalonDock.DockingManager._ExecuteCloseCommand(LayoutDocument document)
at Xceed.Wpf.AvalonDock.Controls.LayoutDocumentItem.Close()
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.<InitDefaultCommands>b__24_0(Object p)
at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AvalonDockTabsTest2.App.Main()
```
Reviewed: Extended WPF Toolkit - 2.8.0 (May 04, 2017)
Edited Issue: AvalonDock: Can't add new LayoutDocuments to a LayoutDocumentPane after deserializing [22529]
Simple repro follows. Using the "Add new tab" button will stop working after clicking the "Deserialize" button. Even if re-serializing and deserializing, the new tabs are not visible.
Repro XAML:
```
<Window x:Class="AvalonDockTabsTest2.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:AvalonDockTabsTest2"
xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Orientation="Horizontal">
<Button Content="Add new tab"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="4"
Click="OnAddTabClick" />
<Button Content="Serialize"
Margin="4"
Click="OnSerialize" />
<Button Content="Deserialize"
Margin="4"
Click="OnDeserialize" />
</StackPanel>
<xcad:DockingManager Grid.Row="1" x:Name="DockingManager">
<xcad:LayoutRoot>
<xcad:LayoutPanel>
<xcad:LayoutDocumentPaneGroup>
<xcad:LayoutDocumentPane x:Name="DocPane">
<xcad:LayoutDocument Title="Default" CanClose="False" />
</xcad:LayoutDocumentPane>
</xcad:LayoutDocumentPaneGroup>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
</Grid>
</Window>
```
Repro code-behind:
```
namespace AvalonDockTabsTest2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private int count;
private string serializedLayout;
public MainWindow()
{
this.InitializeComponent();
}
private void OnAddTabClick(object sender, RoutedEventArgs e)
{
LayoutDocument doc = new LayoutDocument();
doc.Title = "test " + this.count;
doc.ContentId = "test" + this.count;
doc.Content = new Grid();
++this.count;
this.DocPane.Children.Add(doc);
}
private void OnDeserialize(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(this.serializedLayout))
{
this.OnSerialize(null, null);
}
XmlLayoutSerializer serializer = new XmlLayoutSerializer(this.DockingManager);
using (StringReader sr = new StringReader(this.serializedLayout))
{
XmlReader xr = XmlReader.Create(sr);
serializer.Deserialize(xr);
}
}
private void OnSerialize(object sender, RoutedEventArgs e)
{
XmlLayoutSerializer serializer = new XmlLayoutSerializer(this.DockingManager);
using (MemoryStream ms = new MemoryStream())
{
serializer.Serialize(ms);
this.serializedLayout = Encoding.ASCII.GetString(ms.ToArray());
}
}
}
}
```
Comments: ** Comment from web user: BoucherS **
Hi,
First, your Default LayoutDocument is missing its ContentId. This means it will not be serialized/deserialized.
Second, in your OnTabClick handler, you do :
```
this.DocPane.Children.Add( doc );
```
but this will only add items into the "DocPane", which will be a different instance upon deserialization. You should try to obtain this LayoutDocumentPane by scanning the DockingManager and adding the new item in it. Something like :
```
var layoutDocumentPaneGroup = ((LayoutDocumentPaneGroupControl)DockingManager.LayoutRootPanel.Children[ 0 ]).Model;
var layoutDocumentPane = layoutDocumentPaneGroup.Descendents().OfType<LayoutDocumentPane>().First();
layoutDocumentPane.Children.Add( doc );
```
Third, Please note v3.2 and v3.3 will not deserialize when using a StringReader. In those version, you will need to use a StreamReader. This will all be fixed in v3.4.
Here's an example of using StreamReader:
```
private void OnSerialize( object sender, RoutedEventArgs e )
{
var layoutSerializer = new XmlLayoutSerializer( DockingManager );
using( var writer = new StreamWriter( "AvalonDockSavedFile.txt" ) )
{
layoutSerializer.Serialize( writer );
}
}
private void OnDeserialize( object sender, RoutedEventArgs e )
{
var layoutSerializer = new XmlLayoutSerializer( DockingManager );
using( var reader = new StreamReader( "AvalonDockSavedFile.txt" ) )
{
layoutSerializer.Deserialize( reader );
}
}
```
――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_
Edited Issue: AvalonDock: If you close a document tab before it has been made visible, application will crash with a NullReferenceException [22530]
Use "add new tab" to add new tabs
Click "close" button **without clicking on the new tab to make it visible**. Application will crash with a NullReferenceException. If you click on the tab at least once to give it visibility, this doesn't appear to reproduce.
This is the stack:
```
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.get_View()
at Xceed.Wpf.AvalonDock.DockingManager.RemoveViewFromLogicalChild(LayoutContent layoutContent)
at Xceed.Wpf.AvalonDock.DockingManager._ExecuteCloseCommand(LayoutDocument document)
at Xceed.Wpf.AvalonDock.Controls.LayoutDocumentItem.Close()
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.<InitDefaultCommands>b__24_0(Object p)
at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AvalonDockTabsTest2.App.Main()
```
Comments: ** Comment from web user: BoucherS **
Hi,
This is already fixed.
The fix is included in v3.1 an up.
――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_
Commented Issue: AvalonDock: If you close a document tab before it has been made visible, application will crash with a NullReferenceException [22530]
Use "add new tab" to add new tabs
Click "close" button **without clicking on the new tab to make it visible**. Application will crash with a NullReferenceException. If you click on the tab at least once to give it visibility, this doesn't appear to reproduce.
This is the stack:
```
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.get_View()
at Xceed.Wpf.AvalonDock.DockingManager.RemoveViewFromLogicalChild(LayoutContent layoutContent)
at Xceed.Wpf.AvalonDock.DockingManager._ExecuteCloseCommand(LayoutDocument document)
at Xceed.Wpf.AvalonDock.Controls.LayoutDocumentItem.Close()
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.<InitDefaultCommands>b__24_0(Object p)
at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AvalonDockTabsTest2.App.Main()
```
Comments: ** Comment from web user: theficus **
I'm using AvalonDock that's part of the WPF Toolkit. Is there a newer version I can use that's publicly available?
Commented Issue: AvalonDock: If you close a document tab before it has been made visible, application will crash with a NullReferenceException [22530]
Use "add new tab" to add new tabs
Click "close" button **without clicking on the new tab to make it visible**. Application will crash with a NullReferenceException. If you click on the tab at least once to give it visibility, this doesn't appear to reproduce.
This is the stack:
```
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.get_View()
at Xceed.Wpf.AvalonDock.DockingManager.RemoveViewFromLogicalChild(LayoutContent layoutContent)
at Xceed.Wpf.AvalonDock.DockingManager._ExecuteCloseCommand(LayoutDocument document)
at Xceed.Wpf.AvalonDock.Controls.LayoutDocumentItem.Close()
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.<InitDefaultCommands>b__24_0(Object p)
at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AvalonDockTabsTest2.App.Main()
```
Comments: ** Comment from web user: BoucherS **
Hi,
I'm also referring to AvalonDock included in the WPF Toolkit.
Current versions are :
-WPF Toolkit Plus Edition : v3.3
-WPF Toolkit Community Edition : v3.0.
WPF Toolkit Plus Edition v3.4 and WPF Toolkit Community Edition v3.1 should be release in the following weeks.
Thanks.
――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_
Commented Issue: AvalonDock: If you close a document tab before it has been made visible, application will crash with a NullReferenceException [22530]
Use "add new tab" to add new tabs
Click "close" button **without clicking on the new tab to make it visible**. Application will crash with a NullReferenceException. If you click on the tab at least once to give it visibility, this doesn't appear to reproduce.
This is the stack:
```
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.get_View()
at Xceed.Wpf.AvalonDock.DockingManager.RemoveViewFromLogicalChild(LayoutContent layoutContent)
at Xceed.Wpf.AvalonDock.DockingManager._ExecuteCloseCommand(LayoutDocument document)
at Xceed.Wpf.AvalonDock.Controls.LayoutDocumentItem.Close()
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.<InitDefaultCommands>b__24_0(Object p)
at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AvalonDockTabsTest2.App.Main()
```
Comments: ** Comment from web user: theficus **
Am I correct in my understanding that the community edition is several versions behind the plus edition?
Commented Issue: AvalonDock: Can't add new LayoutDocuments to a LayoutDocumentPane after deserializing [22529]
Simple repro follows. Using the "Add new tab" button will stop working after clicking the "Deserialize" button. Even if re-serializing and deserializing, the new tabs are not visible.
Repro XAML:
```
<Window x:Class="AvalonDockTabsTest2.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:AvalonDockTabsTest2"
xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Orientation="Horizontal">
<Button Content="Add new tab"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="4"
Click="OnAddTabClick" />
<Button Content="Serialize"
Margin="4"
Click="OnSerialize" />
<Button Content="Deserialize"
Margin="4"
Click="OnDeserialize" />
</StackPanel>
<xcad:DockingManager Grid.Row="1" x:Name="DockingManager">
<xcad:LayoutRoot>
<xcad:LayoutPanel>
<xcad:LayoutDocumentPaneGroup>
<xcad:LayoutDocumentPane x:Name="DocPane">
<xcad:LayoutDocument Title="Default" CanClose="False" />
</xcad:LayoutDocumentPane>
</xcad:LayoutDocumentPaneGroup>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
</Grid>
</Window>
```
Repro code-behind:
```
namespace AvalonDockTabsTest2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private int count;
private string serializedLayout;
public MainWindow()
{
this.InitializeComponent();
}
private void OnAddTabClick(object sender, RoutedEventArgs e)
{
LayoutDocument doc = new LayoutDocument();
doc.Title = "test " + this.count;
doc.ContentId = "test" + this.count;
doc.Content = new Grid();
++this.count;
this.DocPane.Children.Add(doc);
}
private void OnDeserialize(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(this.serializedLayout))
{
this.OnSerialize(null, null);
}
XmlLayoutSerializer serializer = new XmlLayoutSerializer(this.DockingManager);
using (StringReader sr = new StringReader(this.serializedLayout))
{
XmlReader xr = XmlReader.Create(sr);
serializer.Deserialize(xr);
}
}
private void OnSerialize(object sender, RoutedEventArgs e)
{
XmlLayoutSerializer serializer = new XmlLayoutSerializer(this.DockingManager);
using (MemoryStream ms = new MemoryStream())
{
serializer.Serialize(ms);
this.serializedLayout = Encoding.ASCII.GetString(ms.ToArray());
}
}
}
}
```
Comments: ** Comment from web user: theficus **
Thank you! This was very helpful, and non-obvious. :)
Commented Issue: AvalonDock: If you close a document tab before it has been made visible, application will crash with a NullReferenceException [22530]
Use "add new tab" to add new tabs
Click "close" button **without clicking on the new tab to make it visible**. Application will crash with a NullReferenceException. If you click on the tab at least once to give it visibility, this doesn't appear to reproduce.
This is the stack:
```
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.get_View()
at Xceed.Wpf.AvalonDock.DockingManager.RemoveViewFromLogicalChild(LayoutContent layoutContent)
at Xceed.Wpf.AvalonDock.DockingManager._ExecuteCloseCommand(LayoutDocument document)
at Xceed.Wpf.AvalonDock.Controls.LayoutDocumentItem.Close()
at Xceed.Wpf.AvalonDock.Controls.LayoutItem.<InitDefaultCommands>b__24_0(Object p)
at Xceed.Wpf.AvalonDock.Commands.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AvalonDockTabsTest2.App.Main()
```
Comments: ** Comment from web user: BoucherS **
Hi,
Yes, the community edition is always several versions behind the Plus edition and has fewer controls and features.
――――
_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
-
Re. "You could set the AutoCreateColumns to False and only define the columns you want to see and apply specific configuration on them. We don't see the need in our design to have an equivalent to Microsoft AutoGeneratingColumn event. The binding can be done in XAML for each column.": Umm, having to turn off the entire, automatic feature A (i.e., AutoCreateColumns) such that I have to manually (i.e. in XAML) do what A would've done automatically for me just so I can emulate the lack of having feature A.1 (i.e. AutoGeneratingColumn) which would've allowed me to override (albeit in Code-Behind only vs. also XAML but only for some # of elements / ways / times <= all elements / ways / times) what A does automatically does NOT mean there is no "need" for feature A.1. Doing A manually requires me to: a) do it manually for all (vs. <= all) elements / ways / times and b) do so in XAML (vs. Code-Behind) where there is no Compile-Time Identifier and Type checking.
-
Re. setting CellContentStringFormat in Code-Behind: 2.1) You didn't specify where I could to that. Like I said in my original post, I was trying to do it in the Window.Loaded Event Handler. That would not work using either my originally-posted format ("ddd MM/dd/yy hh:mm tt") or in either of the 2 you provided ("{}{0:ddd MM/ dd / yy hh:mm tt}" or "{0:ddd MM/ dd / yy hh:mm tt}"). I finally got it to work by: a) setting it in the DataGridControl.ItemsSourceChangeCompleted Event Handler and b) using a third format ("{0:ddd MM/dd/yy hh:mm tt}"). 2.1) Where is the documentation saying that I have to: a) prefix the Format String with a "0:" and b) enclose the Format String in braces vs. the Format String required by a .NET String.ToString Method's "format" Parameter. I didn't see anything describing that in the docs for the CellContentStringFormat Property (here: https://xceed.com/wp-content/documentation/xceed-datagrid-for-wpf/webframe.html#Xceed.Wpf.DataGrid~Xceed.Wpf.DataGrid.ColumnBase~CellContentStringFormat.html).
-
Re. CellContentTemplate via full Code-Behind: I verified that worked also but, again, not if I set inside the Window.Loaded Event Handler. It worked when set inside the DataGridControl.ItemsSourceChangeCompleted Event Handler.
-
Re. "When / how would one, in Code Behind vs. XAML, use the DisplayedValueConverter Property?": I didn't see an answer to that question (from my 5/3/17 10:32 am comment). I tried it from the DataGridControl.ItemsSourceChangeCompleted Event Handler, and it still did nothing, even though both CellContentStringFormat and CellContentTemplate methods worked from that same Event Handler and latter worked using the same IConverter I was trying to set DisplayedValueConverter to.