Click here to Skip to main content
       

Silverlight / WPF

 
GeneralRe: MVVM:How to bind the MenuItem Command of ListBoxItem ContextMenu dynamically? PinmemberMember 137073829-Dec-12 19:02 
Questionmm PinmemberAishwarya aishu28-Dec-12 0:44 
AnswerRe: mm PinmvpRichard MacCutchan28-Dec-12 5:59 
Generalsiverlight PinmemberAishwarya aishu28-Dec-12 0:42 
GeneralRe: siverlight PinmvpRichard MacCutchan28-Dec-12 5:57 
QuestionDataTrigger bind to a Property Pinmembermbv80023-Dec-12 17:01 
AnswerRe: DataTrigger bind to a Property PinprotectorPete O'Hanlon23-Dec-12 19:17 
AnswerRe: DataTrigger bind to a Property PinmentorWayne Gaylard23-Dec-12 19:39 
First of all, you have not done any binding to your Check Property, binding to myProperty will not help you at all. You need to change your binding to bind to the Check property. Secondly for bindings to react to changes in the bound property you need to implement the INotifyPropertyChanged[^] interface in you viewmodel/code behind. Try this code :
 
<Grid>
        <Button Height="34" HorizontalAlignment="Left" x:Name="toggleBroadcast" VerticalAlignment="Top" Width="133" Margin="180,0,0,0">
            <Button.Style>
                <Style x:Name="bb" TargetType="{x:Type Button}">
                    <Setter Property="Content" Value="Original Content" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=Check}" Value="true">
                            <Setter Property="Content" Value="IS TRUE" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=Check}" Value="false">
                            <Setter Property="Content" Value="IS FALSE" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>
        </Button>
        <Button Content="Click on This Button" HorizontalAlignment="Left" Width="158" Click="Button_Click_1" Height="34" VerticalAlignment="Top" />
    </Grid>
 
public partial class MainWindow : Window,INotifyPropertyChanged
    {
        Boolean _check = false;
 
        public MainWindow()
        {
            DataContext = this;
            InitializeComponent();
        }
 
        public Boolean Check
        {
            get
            {
                return _check;
            }
            set
            {
                if (_check != value)
                {
                    _check = value;
                    OnPropertyChanged("Check");
                }
            }
        }
 
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Check = !Check;
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        public void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

QuestionWPF Adorner Issues PinmvpJohn Simmons / outlaw programmer17-Dec-12 10:52 
AnswerRe: WPF Adorner Issues PinmemberSledgeHammer0118-Dec-12 4:49 
GeneralRe: WPF Adorner Issues PinmvpJohn Simmons / outlaw programmer20-Dec-12 9:09 
GeneralRe: WPF Adorner Issues PinmemberSledgeHammer0121-Dec-12 4:50 
QuestionSilverlight Dynamic indexed binding [modified] PinmemberMember 934221816-Dec-12 18:02 
QuestionThird Party Controls PinmemberKevin Marois11-Dec-12 7:22 
AnswerRe: Third Party Controls PinmemberMycroft Holmes11-Dec-12 12:06 
AnswerRe: Third Party Controls PinprotectorPete O'Hanlon11-Dec-12 12:43 
GeneralRe: Third Party Controls PinmemberKevin Marois12-Dec-12 8:28 
GeneralRe: Third Party Controls PinprotectorPete O'Hanlon12-Dec-12 8:29 
GeneralRe: Third Party Controls PinmemberKevin Marois12-Dec-12 8:30 
GeneralRe: Third Party Controls PinmemberMycroft Holmes12-Dec-12 12:02 
QuestionHow can I Bind a DataTemplate Slider definition to the Code behind? Pinmembermaycockt10-Dec-12 5:24 
AnswerRe: How can I Bind a DataTemplate Slider definition to the Code behind? PinmemberAlisaunder10-Dec-12 13:52 
GeneralRe: How can I Bind a DataTemplate Slider definition to the Code behind? Pinmembermaycockt14-Dec-12 1:18 
QuestionHow does one define IOleServiceProvider in a C# WPF application? PinmemberXarzu10-Dec-12 3:54 
AnswerRe: How does one define IOleServiceProvider in a C# WPF application? PinprotectorPete O'Hanlon10-Dec-12 4:08 

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

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


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 16 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid