I'm working on MVVM
and WPF
application. I have a scenario in which i have to edit the viewing image and save it.
I have used RadCarousel
in which using the ContextMenu
on right click i'm editing the image using mspaint
. When i try to save the edited image i get the "Sharing violation error on path
".
The images are located in a shared folder.
//XAML Code:
<telerik:RadCarousel x:Name="MarketSeriesCarousel"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{Binding Path=MarketSeriesImageList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}"
SelectedItem="{Binding SelectedMarketSeriesImage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}"
Background="Transparent"
HorizontalScrollBarVisibility="Auto"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
telerik:StyleManager.Theme="Windows8"
Focusable="True"
PropertyChanged="MarketSeriesCarousel_PropertyChanged">
<telerik:RadCarousel.ContextMenu>
<ContextMenu >
<MenuItem Header="Edit" Command="{Binding EditImage}" CommandParameter="{Binding }"/>
<MenuItem Header="MetaData" IsEnabled="False"/>
<MenuItem Header="Delete" Command="{Binding DeleteImage}"/>
</ContextMenu>
</telerik:RadCarousel.ContextMenu>
<telerik:RadCarousel.ItemsPanel>
<ItemsPanelTemplate>
<telerik:RadCarouselPanel Path="{StaticResource path}"
telerik:StyleManager.Theme="Windows8" >
</telerik:RadCarouselPanel>
</ItemsPanelTemplate>
</telerik:RadCarousel.ItemsPanel>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding ViewSeriesImage}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</telerik:RadCarousel>
//ViewModel Code:
/// <summary>
/// Edit image viewer.
/// </summary>
private void EditImageViewer()
{
try
{
ProcessStartInfo startInfo = new ProcessStartInfo(ImagePath);
startInfo.Verb = "edit";
Process proc = Process.Start(startInfo);
}
catch (Exception ex)
{
// Error handling.
throw new ApplicationException(ex.Message);
}
}
Any possible ways that i can achieve this? Or any alternatives for image editing.
But i need all the functionalities in the mspaint
.