I have a UNC path like \\machine\share\folder\something\ and I need to be able to open that location in windows explorer when a button is clicked. What WPF control should I use and how should I bind to that control from my viewModel?
An example of my viewModel is:
public class ViewModel : Screen {
public string LogPath { get { return "\\machine\share\folder\something"; } }
}
I'm using Caliburn Micro, but I don't know if that's relevant.
If I'm understanding your question properly, the use of WPF, Caliburn, etc is fairly irrelevant. You simply need a function on your ViewModel that runs the following code:
Process.Start(new ProcessStartInfo
{
FileName = "\\\\machine\\share\\folder\\something",
UseShellExecute = true
});
I would use a simple Button control with a Command that is bound to your ViewModel, and potentially a CommandArgument to specify the path to launch if you need to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With