I have a wpf List View control. For the grid column i have specified the width.
However, the column can be resized by the user. I want dont want to give this feature.
How do i do this?
WPF code is below
<ListView x:Name="lstBacnetDeviceList" VerticalAlignment="Top" Margin="0,0,0,2" FontFamily="Microsoft Sans Serif"local:ListViewSorter.CustomListViewSorter="ReflashTool.Components.ListViewSorter.DevicePropertiesComparer"
>
<ListView.Resources>
<ordinal:OrdinalConverter x:Key="OrdinalConverter" />
<DataTemplate x:Key="OrdinalColumnDataTemplate">
<Border BorderBrush="#FF000000" BorderThickness="0.25,0.25,0.25,0.25" Margin="-6,-8,-7,-10" Padding="0,2,0,0" HorizontalAlignment="Center" Width="35" Background="LightGray">
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem},
Converter={StaticResource ResourceKey=OrdinalConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</DataTemplate>
</ListView.Resources>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Width="35" CellTemplate="{StaticResource ResourceKey=OrdinalColumnDataTemplate}" />
<GridViewColumn Header="Select" Width="50" local:ListViewSorter.PropertyName="DeviceSelected">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Border BorderBrush="#FF000000" BorderThickness="0.25,0.25,0.25,0.25" Margin="-5,-8,-7,-10" Padding="0,0,0,0" Width="50">
<CheckBox Name="chkDeviceSelect" IsChecked="{Binding Path=DeviceSelected,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Device ID" Width="100" local:ListViewSorter.PropertyName="DeviceAddress">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Border BorderBrush="#FF000000" BorderThickness="0.25,0.25,0.25,0.25" Margin="-5,-8,-7,-10" Padding="3,2,0,0">
<TextBlock FontFamily="Microsoft Sans Serif" Text="{Binding Path=DeviceAddress}" Width="98" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn> </GridView>
</ListView.View>
</ListView>