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

WPF

 
GeneralRe: How to programmatically add links to quick launch bar and start menu under WPF (SOLVED) Pin
fjparisIII18-Jul-09 10:49
fjparisIII18-Jul-09 10:49 
GeneralRe: How to programmatically add links to quick launch bar and start menu under WPF (NOT SOLVED after all, sigh...) Pin
fjparisIII18-Jul-09 12:26
fjparisIII18-Jul-09 12:26 
GeneralRe: How to programmatically add links to quick launch bar and start menu under WPF (SOLVED) Pin
samip shrestha29-Nov-09 18:59
samip shrestha29-Nov-09 18:59 
GeneralRe: How to programmatically add links to quick launch bar and start menu under WPF (SOLVED) Pin
fjparisIII30-Nov-09 12:49
fjparisIII30-Nov-09 12:49 
AnswerRe: How to programmatically add links to quick launch bar and start menu under WPF Pin
Mark Salsbery19-Jul-09 8:31
Mark Salsbery19-Jul-09 8:31 
GeneralRe: How to programmatically add links to quick launch bar and start menu under WPF Pin
fjparisIII19-Jul-09 13:25
fjparisIII19-Jul-09 13:25 
GeneralRe: How to programmatically add links to quick launch bar and start menu under WPF Pin
fjparisIII19-Jul-09 13:29
fjparisIII19-Jul-09 13:29 
QuestionTwo-way binding problem Pin
Ravadre17-Jul-09 9:42
Ravadre17-Jul-09 9:42 
Hi,
Recently I'm trying to learn WPF, and I've stumbled across a problem, I can solve it, but I'm not happy with the result code, so maybe someone could help me to polish it a bit.

Let's say, I have class XManager, that manages classes X, also, it has reference to currently active X instance, each class X has it's own Text property, I want to do a two way binding between textbox and this text property.

It looks like this:
class XManager
{
  private X activeX;

  public X ActiveX
  {
    get { return activeX; }
  }
}

class X : INotifyPropertyChanged
{
  public string Text { get; set; }

  public void PutSomeTextProgramatically(string someText)
  {
    Text += someText;
    if (PropertyChanged != null)
      PropertyChanged(this, new PropertyChangedEventArgs("Text"));
  }
}


Now, I do have a manager accessible from XAML:
<Windows.Resources>
  <local:XManager x:Key="xManager"/>
</Windows.Resources>


My binding to it looks like this:
<TextBox Name="someBox">
  <TextBox.Text>
    <Binding Mode="TwoWay" Source="{StaticResource xManager}" Path="ActiveX.Text" />
  </TextBox.Text>
</TextBox>


Such code won't work properly, because we've binded to XManager's "ActiveX.Text", but we never change it, so workaroun I did was to add do my manager such code:
//This one is invoked when activeSession signals PropChange
void XSession_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
  if (e.PropertyName == "Text")
  {
    if (PropertyChanged != null)
      PropertyChanged(this, new PropertyChangedEventArgs("ActiveSession.Text"));
  }
}


Now it will work, but I find such code a bit ugly, I'd like to bind "directly" to PropertyChange event inside XSession, not to some sort of a wrapper. Is this possible, or maybe I don't see something obvious?
AnswerRe: Two-way binding problem Pin
User 27100918-Jul-09 5:21
User 27100918-Jul-09 5:21 
GeneralRe: Two-way binding problem Pin
Ravadre18-Jul-09 5:56
Ravadre18-Jul-09 5:56 
GeneralRe: Two-way binding problem Pin
User 27100918-Jul-09 6:04
User 27100918-Jul-09 6:04 
GeneralRe: Two-way binding problem Pin
Ravadre18-Jul-09 6:10
Ravadre18-Jul-09 6:10 
GeneralRe: Two-way binding problem Pin
User 27100918-Jul-09 6:14
User 27100918-Jul-09 6:14 
GeneralRe: Two-way binding problem Pin
Ravadre18-Jul-09 6:27
Ravadre18-Jul-09 6:27 
GeneralRe: Two-way binding problem Pin
User 27100918-Jul-09 6:34
User 27100918-Jul-09 6:34 
GeneralRe: Two-way binding problem Pin
Ravadre18-Jul-09 7:15
Ravadre18-Jul-09 7:15 
QuestionMessage Removed Pin
16-Jul-09 9:27
professionalN_tro_P16-Jul-09 9:27 
AnswerRe: Visibiltiy Collapse issues Pin
User 27100918-Jul-09 5:29
User 27100918-Jul-09 5:29 
GeneralMessage Removed Pin
20-Jul-09 6:15
professionalN_tro_P20-Jul-09 6:15 
GeneralRe: Visibiltiy Collapse issues Pin
User 27100920-Jul-09 16:51
User 27100920-Jul-09 16:51 
QuestionWhat causes an Expander to expand in the designer Pin
Luke Edwards16-Jul-09 2:33
Luke Edwards16-Jul-09 2:33 
AnswerRe: What causes an Expander to expand in the designer Pin
Christian Graus16-Jul-09 7:17
protectorChristian Graus16-Jul-09 7:17 
AnswerRe: What causes an Expander to expand in the designer Pin
Mark Salsbery16-Jul-09 7:50
Mark Salsbery16-Jul-09 7:50 
GeneralRe: What causes an Expander to expand in the designer Pin
Luke Edwards21-Jul-09 5:42
Luke Edwards21-Jul-09 5:42 
QuestionWhat's your [technical] opinion regarding a communications layer in a multi-tier environment? Pin
Stevie15-Jul-09 23:58
Stevie15-Jul-09 23:58 

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.