Hi, I'm new in WPF I'm creating object in XAML like this
<Window.Resources>
<local:DataReceiver x:Key="request">
</local:DataReceiver>
</Window.Resources>
how can I call this objects method from codebehind?
Hi, I'm new in WPF I'm creating object in XAML like this
<Window.Resources>
<local:DataReceiver x:Key="request">
</local:DataReceiver>
</Window.Resources>
how can I call this objects method from codebehind?
DataReceiver request = this.TryFindResource("request") as DataReceiver;
if (request != null)
{
// your code here
}
var dataReceiver = (DataReceiver)FindResource("request");
...