Click here to Skip to main content
15,898,134 members
Home / Discussions / WPF
   

WPF

 
QuestionValidation Pin
eddieangel3-Nov-10 12:13
eddieangel3-Nov-10 12:13 
Questiondefault button height? Pin
SledgeHammer013-Nov-10 10:02
SledgeHammer013-Nov-10 10:02 
AnswerRe: default button height? Pin
Nish Nishant3-Nov-10 11:30
sitebuilderNish Nishant3-Nov-10 11:30 
QuestionNeed information about GetStylesWithTargetType Pin
mtproc3-Nov-10 9:16
mtproc3-Nov-10 9:16 
AnswerRe: Need information about GetStylesWithTargetType Pin
mtproc4-Nov-10 5:50
mtproc4-Nov-10 5:50 
QuestionListView Inside TreeListView Pin
krishnan.s3-Nov-10 5:57
krishnan.s3-Nov-10 5:57 
AnswerRe: ListView Inside TreeListView Pin
Kevin Marois11-Nov-10 5:39
professionalKevin Marois11-Nov-10 5:39 
QuestionBinding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan2-Nov-10 19:55
ananddayalan2-Nov-10 19:55 
AnswerRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
Abhinav S2-Nov-10 21:54
Abhinav S2-Nov-10 21:54 
GeneralRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan3-Nov-10 19:26
ananddayalan3-Nov-10 19:26 
GeneralRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan3-Nov-10 19:30
ananddayalan3-Nov-10 19:30 
AnswerRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
Abhinav S4-Nov-10 4:53
Abhinav S4-Nov-10 4:53 
GeneralRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan4-Nov-10 15:40
ananddayalan4-Nov-10 15:40 
GeneralRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
RichardGrimmer10-Nov-10 5:02
RichardGrimmer10-Nov-10 5:02 
QuestionDrive and File access in Silverlight??? Pin
MichaelGaudioso2-Nov-10 6:56
MichaelGaudioso2-Nov-10 6:56 
AnswerRe: Drive and File access in Silverlight??? Pin
Kunal Chowdhury «IN»2-Nov-10 9:12
professionalKunal Chowdhury «IN»2-Nov-10 9:12 
GeneralRe: Drive and File access in Silverlight??? Pin
MichaelGaudioso2-Nov-10 9:15
MichaelGaudioso2-Nov-10 9:15 
AnswerRe: Drive and File access in Silverlight??? Pin
Abhinav S2-Nov-10 17:35
Abhinav S2-Nov-10 17:35 
QuestionCrystal reports with WPF Pin
Kamal Gurnani31-Oct-10 21:02
Kamal Gurnani31-Oct-10 21:02 
AnswerRe: Crystal reports with WPF Pin
Mycroft Holmes31-Oct-10 23:23
professionalMycroft Holmes31-Oct-10 23:23 
AnswerRe: Crystal reports with WPF Pin
Abhinav S31-Oct-10 23:42
Abhinav S31-Oct-10 23:42 
QuestionTrivial data binding to member variables. Pin
Barry Lapthorn31-Oct-10 2:23
protectorBarry Lapthorn31-Oct-10 2:23 
AnswerRe: Trivial data binding to member variables. Pin
venugopalm1-Nov-10 3:54
venugopalm1-Nov-10 3:54 
Hi Barry,

This is by design. Designer never look for the code behind of your current class. If you want provide designer support, move all your property declaration from your current class to another class and inherit to your current class.

For example, create extended window with your property like below mentioned.

<br />
  public class ExtendedWindow : Window<br />
    {<br />
        public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register("FileName", typeof(string), typeof(ExtendedWindow));<br />
        public string FileName<br />
        {<br />
            get<br />
            {<br />
                return (string)GetValue(FileNameProperty);<br />
            }<br />
            set<br />
            {<br />
                SetValue(FileNameProperty, value);<br />
            }<br />
        }    <br />
    }<br />
<br />


Now inherit this extended class to your MyWindow class

<br />
 public partial class MainWindow : ExtendedWindow<br />
    {<br />
        public MainWindow()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
<br />
       <br />
        private void buttonTest_Click(object sender, RoutedEventArgs e) <br />
        { <br />
            Microsoft.Win32.OpenFileDialog d = new Microsoft.Win32.OpenFileDialog();<br />
            if (d.ShowDialog() == true)  <br />
                this.FileName = d.FileName;<br />
        }       <br />
        private void buttonToggle_Click(object sender, RoutedEventArgs e) <br />
        { <br />
            this.FileName = "Toggle clicked."; <br />
        }<br />
    }<br />


Xaml
<local:ExtendedWindow x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfApplication1"
        Title="MainWindow" Height="350" Width="525"
        x:Name="root">
        <StackPanel>
            <DockPanel>
                
                <Button DockPanel.Dock="Right" Height="23" Click="buttonTest_Click">Browse...</Button>
                <TextBox DockPanel.Dock="Left"
                Height="23" Margin="0,0,2,0" Name="textBoxFileName"                      Text="{Binding ElementName=root, Mode=TwoWay, Path=FileName}"/>
            </DockPanel>
            <DockPanel>
                <TextBlock DockPanel.Dock="Bottom" Text="{Binding ElementName=root, Mode=TwoWay, Path=FileName}"></TextBlock>
                <Button DockPanel.Dock="Bottom" Name="buttonToggle" Click="buttonToggle_Click">Toggle...</Button>
            </DockPanel>
        </StackPanel>
    </local:ExtendedWindow>

Now property editor will identify FileName property without any issue.
MVVM devotee Smile | :)

GeneralRe: Trivial data binding to member variables. Pin
Barry Lapthorn6-Nov-10 3:44
protectorBarry Lapthorn6-Nov-10 3:44 
QuestionRichtextbox databinding Pin
Mycroft Holmes30-Oct-10 0:16
professionalMycroft Holmes30-Oct-10 0: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.