Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to add an image at right hand side of textblock when numeric change

$
0
0

How to add an image at right hand side of textblock when numeric change

GridView is bind with this class, when number > 0 use up arrow image at right hand side of textblock

public class Stock: INotifyPropertyChanged
    {
        private string stockID;
        private double lastPrice;
        private double vGMoment;

        public Stock()
        {
  
        }

        public string StockID
        {
            get 
            { 
                return stockID; 
            }
            set
            {
                if (StockID != value)
                {
                    stockID = value;
                    OnPropertyChanged("StockID");
                }
            }
        }
        public double LastPrice
        {
            get { return lastPrice; }
            set
            {
                if (LastPrice != value)
                {
                    lastPrice = value;
                    OnPropertyChanged("LastPrice");

                    
                }
            }
        }
        public double VGMoment
        {
            get
            {
                return vGMoment;
            }
            set
            {
                if (VGMoment != value)
                {
                    vGMoment = value;
                    OnPropertyChanged("VGMoment");
                }
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(String info)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(info));
            }
        }

        
    }

Image imgMessage = new Image();
                imgMessage.Visibility = System.Windows.Visibility.Collapsed;
                BitmapImage bi = new BitmapImage();

                bi.BeginInit();
                bi.UriSource = new Uri(@"C:\Users\Documents\Visual Studio 2010\Projects\testrealtimdatagrid\testrealtimdatagrid\bin\Debug\green-up-arrow.gif", UriKind.RelativeOrAbsolute);
                bi.EndInit();

                imgMessage.Source = bi;

                InlineUIContainer iuc = new InlineUIContainer(imgMessage);
                this.Inlines.Add(iuc);
                this.Inlines.Add(run);


No need to worry as many books are not the core and true story


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>