Hello I have a model called FileDirectoryModel
and it contains:
public class FileDirectoryModel
{
public string imgPath { get; set; }
public string DirPath { get; set; }
public string FileName { get; set; }
public string size { get; set; }
public string FileType { get; set; }
public DateTime Modifed { get; set; }
public string FullName { get; set; }
}
I also have a ListView :
<ListView x:Name="lstExplorer"
Background="White"
ItemsSource="{Binding DirectoryCollection}"
SelectedItem="{Binding SelectedModel}"
>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding FileExplorerClickCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.View>
<GridView>
<GridViewColumn Header="Name"
Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding imgPath}"
Height="20"
Width="20"
Stretch="Fill"/>
<TextBlock x:Name="explorerText"
Text="{Binding FileName}">
</TextBlock>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="50">
<GridViewColumnHeader>
<TextBlock Text="Size" />
</GridViewColumnHeader>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding size}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100">
<GridViewColumnHeader>
<TextBlock Text="Type" />
</GridViewColumnHeader>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding FileType}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100">
<GridViewColumnHeader>
<TextBlock Text="Modifed" />
</GridViewColumnHeader>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Modifed}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
and DirectoryCollection
is :
private ObservableCollection<FileDirectoryModel> _DirectoryCollection;
public ObservableCollection<FileDirectoryModel> DirectoryCollection
{
get { return _DirectoryCollection; }
set
{
if (_DirectoryCollection != value)
{
_DirectoryCollection = value;
OnPropertyChanged();
}
}
}
There is a dubbleclick command that will open the file that is selected but I'm having a hard time trying yo figure out how to allow someone to change the name of the selected item.
Please note that I saw File ListView, Change name which doesn't apply because they are telling how to change the file name not how to have xaml allow the change.