Is there a way to prevent template column contents from appearing in the new row? In the screen shot you can see that the red delete icon is appearing in the new row. I wish to hide this in the new row.
Regards
Myles Johnson
This can be done with a value converter hooked up to the Visibility property of the button in your template.
Below is some sample code showing how to create a simple value converter and how to hook it up to the Button in the template.
<UserControl x:Class="SilverlightApplication16.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SilverlightApplication16"
xmlns:iggrid="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebGrid.v9.2"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<Grid.Resources>
<local:MyValueConverter x:Key="myConvert"></local:MyValueConverter>
</Grid.Resources>
<iggrid:XamWebGrid x:Name="grid">
<iggrid:XamWebGrid.AddNewRowSettings>
<iggrid:AddNewRowSettings AllowAddNewRow="Top"></iggrid:AddNewRowSettings>
</iggrid:XamWebGrid.AddNewRowSettings>
<iggrid:XamWebGrid.Columns>
<iggrid:TemplateColumn Key="blah">
<iggrid:TemplateColumn.ItemTemplate>
<DataTemplate>
<Button Content="Delete" Visibility="{Binding Converter={StaticResource myConvert}}" ></Button>
</DataTemplate>
</iggrid:TemplateColumn.ItemTemplate>
</iggrid:TemplateColumn>
</iggrid:XamWebGrid.Columns>
</iggrid:XamWebGrid>
</Grid>
</UserControl>
public class MyValueConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Person p = value as Person;
if (p == null || p.Name == null)
return Visibility.Collapsed;
}
return Visibility.Visible;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException();
#endregion
Seems like overkill when you could simply write the following one liner:
RowsManager.AddNewRowTop.Cells["Delete"].Control.Visibility = Visibility.Collapsed;
Regards,