Click here to Skip to main content
15,892,059 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: is there and development studio for silverlight reporting services Pin
vinu.111110-Nov-10 21:30
vinu.111110-Nov-10 21:30 
AnswerRe: is there and development studio for silverlight reporting services Pin
Abhinav S10-Nov-10 22:05
Abhinav S10-Nov-10 22:05 
QuestionHow can you check if Mouse is ButtonDown from MouseMove handler...? Pin
devvvy10-Nov-10 19:00
devvvy10-Nov-10 19:00 
AnswerRe: How can you check if Mouse is ButtonDown from MouseMove handler...? Pin
Abhinav S10-Nov-10 20:13
Abhinav S10-Nov-10 20:13 
QuestionDisplay of WPF application messed up on maximize/minimize Pin
BRShroyer10-Nov-10 7:22
BRShroyer10-Nov-10 7:22 
AnswerRe: Display of WPF application messed up on maximize/minimize Pin
Abhinav S10-Nov-10 22:10
Abhinav S10-Nov-10 22:10 
GeneralRe: Display of WPF application messed up on maximize/minimize Pin
BRShroyer11-Nov-10 1:23
BRShroyer11-Nov-10 1:23 
QuestionSilverligt Binding Problem to User Control Pin
[ac]Sebastian9-Nov-10 7:50
[ac]Sebastian9-Nov-10 7:50 
Hello,
i have a problem to bind a UserControl to data from my main page:
I cant bind a property from my data class to my user control in my xaml code.

My User Control:
namespace WindowsPhoneTestApp
{
   public partial class TestControl : UserControl
   {
      public static readonly DependencyProperty nameProperty = DependencyProperty.Register(
            "name",
            typeof(string),
            typeof(TestControl),
            new PropertyMetadata("99999"));

      public string name
      {
         get { return (string)GetValue(TestControl.nameProperty); }
         set { SetValue(TestControl.nameProperty, value); }
      }

      public TestControl()
      {
         InitializeComponent();
         DataContext = this;
      }
   }
}


XAML:
<UserControl x:Class="WindowsPhoneTestApp.TestControl"
    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:local="clr-namespace:WindowsPhoneTestApp"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="92" d:DesignWidth="328">
    
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" Height="88" Width="324">
        <StackPanel>
            <TextBlock Name="text" Text="{Binding name, Mode=OneWay}" FontSize="48" Foreground="#ffffffff" Height="88" />
        </StackPanel>
    </Grid>
</UserControl>


Now i try to bind my property name with the dataclass DataSource:
public class DataSource : INotifyPropertyChanged
   {
      public DataSource()
      {
      }

      private string _dataName = "default name";
      public string dataName
      {
         get { return _dataName; }
         set
         {
            if (_dataName == value)
            {
               return;
            }
            _dataName = value;
            this.NotifyPropertyChanged("dataName");
         }
      }

      #region INotifyPropertyChanged
      public event PropertyChangedEventHandler PropertyChanged;

      private void NotifyPropertyChanged(String info)
      {
         if (PropertyChanged != null)
         {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
         }
      }
      #endregion
   }


Using the User control in my Main Page
<code>
public DataSource dataSource { get; set; }

      // Constructor
      public MainPage()
      {
         InitializeComponent();
         dataSource = new DataSource();



         DataContext = this;
         
         dataSource.dataName = "new name";
      }
</code>

<code>
<!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <TextBlock Text="{Binding dataSource.dataName}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <local:TestControl name="{Binding dataSource.dataName}"/>  
        </Grid>
</code>


I dont understand why i cant bind the property dataName to my user controls property name.
The binding to the textblock works.
I hope anbody can help me Wink | ;)

Sebastian
AnswerRe: Silverligt Binding Problem to User Control Pin
RobCroll9-Nov-10 14:47
RobCroll9-Nov-10 14:47 
QuestionDisplay HTML page in Silverlight ChildWindow Pin
jadughar9-Nov-10 2:20
jadughar9-Nov-10 2:20 
AnswerRe: Display HTML page in Silverlight ChildWindow Pin
Abhinav S9-Nov-10 16:25
Abhinav S9-Nov-10 16:25 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
jadughar9-Nov-10 21:52
jadughar9-Nov-10 21:52 
AnswerRe: Display HTML page in Silverlight ChildWindow Pin
Abhinav S9-Nov-10 22:20
Abhinav S9-Nov-10 22:20 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
jadughar10-Nov-10 0:47
jadughar10-Nov-10 0:47 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
jadughar10-Nov-10 23:51
jadughar10-Nov-10 23:51 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
Pete O'Hanlon11-Nov-10 0:55
mvePete O'Hanlon11-Nov-10 0:55 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
jadughar12-Nov-10 22:45
jadughar12-Nov-10 22:45 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
Pete O'Hanlon13-Nov-10 11:55
mvePete O'Hanlon13-Nov-10 11:55 
GeneralRe: Display HTML page in Silverlight ChildWindow Pin
jadughar13-Nov-10 19:57
jadughar13-Nov-10 19:57 
Questioncase study Pin
arkiboys8-Nov-10 22:05
arkiboys8-Nov-10 22:05 
AnswerRe: case study Pin
Pete O'Hanlon8-Nov-10 22:16
mvePete O'Hanlon8-Nov-10 22:16 
GeneralRe: case study Pin
Abhinav S8-Nov-10 22:17
Abhinav S8-Nov-10 22:17 
AnswerRe: case study Pin
Abhinav S8-Nov-10 22:16
Abhinav S8-Nov-10 22:16 
QuestionExporting silverlight Datagrid to Excel. Pin
amarnath g8-Nov-10 21:38
amarnath g8-Nov-10 21:38 
AnswerRe: Exporting silverlight Datagrid to Excel. Pin
Abhinav S8-Nov-10 22:12
Abhinav S8-Nov-10 22:12 

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.