i am using this code.
C# Code Here i was attached the html ,c# and xaml code . Can you please refer this
private void Window_Loaded(object sender, RoutedEventArgs e)
{
string curdir = Directory.GetCurrentDirectory();
webBrowser.Navigate(String.Format("file:///{0}/sample.html", curdir));
}
private void btngetdatafrombrowser_Click(object sender, RoutedEventArgs e)
{
try
{
dynamic objdata = webBrowser.InvokeScript("GetData");
if (objdata != null)
MessageBox.Show(objdata);
}
catch (Exception ezx)
{
}
}
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html oncontextmenu="return false" ;>
<head>
<title>Testing</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11,IE=9; IE=8; IE=7; IE=EDGE" />
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<form>
<fieldset class="account-info">
<label>
Select the File
<input type="file" id="inputfile" onchange="ReadFile()" />
</label>
</fieldset>
</form>
</center>
<script>
//Get Sample Function
function GetSampleFunction() {
return "Bala";
}
//Property Variable
var rawData = undefined;
var fr;
//GetData For Select File
function GetData() {
return "data";
}
//read data for select File
function ReadFile() {
var upload = document.getElementById('inputfile');
var f = upload.files[0], read = new FileReader();
fr = new FileReader();
fr.onload = function () {
rawData = fr.result;
};
fr.readAsArrayBuffer(f);
}
</script>
</body>
</html>
<WebBrowser x:Name="webBrowser" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" ObjectForScripting="HtmlInteropClass" Navigated="webBrowser_Navigated" Navigating="webBrowser_Navigating">
<WebBrowser.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-0.018"/>
<TranslateTransform/>
</TransformGroup>
</WebBrowser.RenderTransform>
</WebBrowser>
<Button Grid.Row="1" Name="btngetdatafrombrowser" Click="btngetdatafrombrowser_Click" Background="SkyBlue" Foreground="White" FontSize="34">Getdata</Button>
But i don't want to use this.its possible to do this in wpf application without using web browser control.
this thing happens by using web browser control but it should done without using the web browser