WPF
I have a problem with DataGrid and ListBox. Users can add new rows to datagrid, but an empty row is visible in listbox.
I found info about NewItemPlaceHolder, but I don't know how to hide it in listbox.
Please, help me! :D
XAML:
ListBox AlternationCount="2" ItemContainerStyle="{StaticResource alternatingWithTriggers}" x:Name="ViewListBox" Background="AliceBlue" ItemsSource="{Binding Converter={StaticResource IgnoreNewItemPlaceholderConverter}}"
CS:
public static readonly IgnoreNewItemPlaceholderConverter Instance = new IgnoreNewItemPlaceholderConverter();
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null && value.ToString() == "{NewItemPlaceholder}")
{
return DependencyProperty.UnsetValue;
}
MessageBox.Show(value.ToString());
return value;
}
Aucun commentaire:
Enregistrer un commentaire