Click here to Skip to main content
15,891,900 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF -Button control Pin
Christian Graus6-Jun-09 12:34
protectorChristian Graus6-Jun-09 12:34 
GeneralRe: WPF -Button control Pin
cbe_pav5-Jun-09 18:31
cbe_pav5-Jun-09 18:31 
GeneralRe: WPF -Button control Pin
ABitSmart5-Jun-09 18:44
ABitSmart5-Jun-09 18:44 
GeneralRe: WPF -Button control Pin
cbe_pav5-Jun-09 19:17
cbe_pav5-Jun-09 19:17 
GeneralRe: WPF -Button control Pin
ABitSmart5-Jun-09 19:23
ABitSmart5-Jun-09 19:23 
GeneralRe: WPF -Button control Pin
cbe_pav5-Jun-09 19:32
cbe_pav5-Jun-09 19:32 
QuestionProgress Bar Not Updating [SOLVED (kind of)] Pin
#realJSOP5-Jun-09 3:25
mve#realJSOP5-Jun-09 3:25 
AnswerRe: Progress Bar Not Updating [SOLVED (kind of)] Pin
Mark Salsbery5-Jun-09 9:46
Mark Salsbery5-Jun-09 9:46 
John Simmons / outlaw programmer wrote:
Any Comments?


Yeah - what did you do wrong? Smile | :)

Binding Value to either a dependency property or a property with INotifyPropertyChanged
implemented works for me. For example:
public partial class Window2 : Window
{
    public Window2()
    {
        InitializeComponent();
    }

    public static DependencyProperty PercentDoneProperty =
                DependencyProperty.Register("PercentDone", typeof(double), typeof(Window2));
    public double PercentDone
    {
        get { return (double)GetValue(PercentDoneProperty); }
        set
        {
            SetValue(PercentDoneProperty, value);
        }
    }

    MyTestClass mtc = new MyTestClass();

    private void progbar_Loaded(object sender, RoutedEventArgs e)
    {
        // This one binds to the dependency property
        progbar.DataContext = this;
        // This one binds to the INotifyPropertyChanged-implemented property
        //progbar.DataContext = mtc;

        DispatcherTimer dispatcherTimer = new DispatcherTimer();
        dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
        dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 250);
        dispatcherTimer.Start();
    }

    void dispatcherTimer_Tick(object sender, EventArgs e)
    {
        if (PercentDone < 100)
            PercentDone = PercentDone + 1;
        if (mtc.PercentDone < 100)
            mtc.PercentDone = mtc.PercentDone + 1;
    }

}


public class MyTestClass : INotifyPropertyChanged
{
    private double _percentDone = 0;
    public double PercentDone
    {
        get { return _percentDone; }
        set { _percentDone = value; Changed("PercentDone"); }
    }

    #region INotifyPropertyChanged Implementation

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void Changed(string propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    #endregion
}

<Window x:Class="WPFTester.Window2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFTester"
    Title="Window2" Height="450" Width="500" >
    <Grid >
        <StackPanel >
            <ProgressBar x:Name="progbar" Width="200" Height="20" Value="{Binding Path=PercentDone}" Loaded="progbar_Loaded" /> 
        </StackPanel>
    </Grid>
</Window>


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Progress Bar Not Updating [SOLVED (kind of)] Pin
#realJSOP5-Jun-09 10:10
mve#realJSOP5-Jun-09 10:10 
GeneralRe: Progress Bar Not Updating [SOLVED (kind of)] Pin
Mark Salsbery5-Jun-09 10:25
Mark Salsbery5-Jun-09 10:25 
GeneralRe: Progress Bar Not Updating [SOLVED (kind of)] Pin
#realJSOP5-Jun-09 12:41
mve#realJSOP5-Jun-09 12:41 
GeneralRe: Progress Bar Not Updating [SOLVED (kind of)] Pin
Mark Salsbery5-Jun-09 12:47
Mark Salsbery5-Jun-09 12:47 
AnswerRe: Progress Bar Not Updating [SOLVED (kind of)] Pin
Raja.Lakshman3-Apr-10 18:08
Raja.Lakshman3-Apr-10 18:08 
QuestionProgress Bar and the BackGroundWorker Pin
Etienne_1235-Jun-09 2:25
Etienne_1235-Jun-09 2:25 
AnswerRe: Progress Bar and the BackGroundWorker Pin
ABitSmart5-Jun-09 3:36
ABitSmart5-Jun-09 3:36 
AnswerRe: Progress Bar and the BackGroundWorker Pin
Mark Salsbery5-Jun-09 6:15
Mark Salsbery5-Jun-09 6:15 
QuestionHow to FindControls in ListView Pin
Glyn1235-Jun-09 1:25
Glyn1235-Jun-09 1:25 
AnswerRe: How to FindControls in ListView Pin
Pete O'Hanlon5-Jun-09 2:00
mvePete O'Hanlon5-Jun-09 2:00 
GeneralRe: How to FindControls in ListView Pin
Glyn1235-Jun-09 4:03
Glyn1235-Jun-09 4:03 
GeneralRe: How to FindControls in ListView Pin
Pete O'Hanlon5-Jun-09 4:14
mvePete O'Hanlon5-Jun-09 4:14 
GeneralRe: How to FindControls in ListView Pin
Glyn1238-Jun-09 2:23
Glyn1238-Jun-09 2:23 
GeneralRe: How to FindControls in ListView Pin
Pete O'Hanlon8-Jun-09 5:04
mvePete O'Hanlon8-Jun-09 5:04 
QuestionPage turn in wpf 3d Pin
AmirHossein.M.Ojvar4-Jun-09 20:50
AmirHossein.M.Ojvar4-Jun-09 20:50 
AnswerRe: Page turn in wpf 3d Pin
Pete O'Hanlon4-Jun-09 21:55
mvePete O'Hanlon4-Jun-09 21:55 
QuestionText and Image in header in listview Pin
krishnan.s4-Jun-09 20:16
krishnan.s4-Jun-09 20:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.