so , i am new to the development field..
In my wpf, I'm trying to use, "PriceWPF" value from CandelClass
I've been plowing around, I don't understand my mistake...
I feel like the problem lies in datacontext
Here is a sample of the code
MainWindows.xaml.cs
namespace Wpf_bot {
public partial class MainWindow: Window {
public MainWindow() {
InitializeComponent();
this.DataContext = new CandelCheckClass();
CandelCheckClass.KlineInfo();
}
}
}
Model.cs
using System.Text;
using System.ComponentModel;
using System.IO;
namespace Wpf_bot
{
public class CandelCheckClass : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public decimal PriceWPF { get; set; }
public static void KlineInfo()
{
var dd = new CandelCheckClass();
dd.PriceWPF = 10;
}
}
}
MainWindow.xaml
<Window x:Class="Wpf_bot.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:fc="clr-namespace:FancyCandles;assembly=FancyCandles"
Title="MainWindow" Height="600" Width="1100"\>
<Grid x:Name="Layout" Margin="10,432,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0*" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<fc:CandleChart CandlesSource="{Binding Path=.}" Margin="10,-400,0,20" HorizontalAlignment="Left" Width="800" Grid.ColumnSpan="2" />
<TextBox Name="priceBox" IsReadOnly="True" Text="{Binding PriceWPF , StringFormat=Price : {0} BUSD}" Width="150" HorizontalAlignment="Left" Background="#FFFFDBDB" TextAlignment="Center" BorderBrush="#FFBFA5A2" Margin="10,10,0,20" FontWeight="Bold" FontFamily="Calibri" FontSize="14" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Height="40"/>
<Grid.RowDefinitions>
<RowDefinition Height="0*" />
<RowDefinition />
<RowDefinition Height="0*"/>
</Grid.RowDefinitions>
</Grid>
\</Window\>