I'm using c# and wpf.
I have an problem with DataBinding. I have a referance to a bluetooth communication dll and when connection done there is DataChanged event returns like DataChangedEventArgs arg. I'm simple version of handling it with
private async void BtOnValueChanged(object sender, DataChangedEventArgs arg)
{
await this.Dispatcher.InvokeAsync(() =>
{
textblock1.Text=arg.data1;
textblock.Text=arg.data2;
image1.Visibility=(arg.data3 ? Visibility.Visible : Visibility.Hidden);
if(data2>100)
textblock1.Foreground=Color.Red;
});
}
DataChangedEventArgs has a class like
public class DataChangedEventArgs
{
public string data1 {get;set;}
public double data2 {get;set;}
public bool data3 {get;set;}
}
but I want to do it with Xaml Binding. Only a few things that I need to do with event handler. I tried to get it from direct binding Datachangedevent nothing was show up. Also tried to get all args like
public static DataChangedEventArgs DataArg;
....
....
private async void BtOnValueChanged(object sender, DataChangedEventArgs arg)
{
await this.Dispatcher.InvokeAsync(() =>
{
DataArg=arg;
});
}
also tried to bind source in code but I couldn't handle it.
Can anyone help me.