Click here to Skip to main content
15,868,016 members
Home / Discussions / WPF
   

WPF

 
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 
AnswerRe: Richtextbox databinding Pin
Abhinav S30-Oct-10 18:26
Abhinav S30-Oct-10 18:26 
GeneralRe: Richtextbox databinding Pin
Mycroft Holmes30-Oct-10 20:38
professionalMycroft Holmes30-Oct-10 20:38 
GeneralRe: Richtextbox databinding Pin
Abhinav S30-Oct-10 23:52
Abhinav S30-Oct-10 23:52 
GeneralRe: Richtextbox databinding Pin
Mycroft Holmes2-Nov-10 12:26
professionalMycroft Holmes2-Nov-10 12:26 
QuestionXBAP Security Question and poking around for thoughts Pin
rwinte28-Oct-10 6:37
rwinte28-Oct-10 6:37 
QuestionWPF perfomance Pin
afsal qureshi28-Oct-10 3:17
afsal qureshi28-Oct-10 3:17 
AnswerRe: WPF perfomance Pin
RugbyLeague28-Oct-10 3:46
RugbyLeague28-Oct-10 3:46 
GeneralRe: WPF perfomance Pin
afsal qureshi28-Oct-10 5:09
afsal qureshi28-Oct-10 5:09 
GeneralRe: WPF perfomance Pin
Simon_Whale28-Oct-10 5:15
Simon_Whale28-Oct-10 5:15 
GeneralRe: WPF perfomance Pin
RugbyLeague28-Oct-10 5:23
RugbyLeague28-Oct-10 5:23 
GeneralRe: WPF perfomance Pin
afsal qureshi28-Oct-10 5:44
afsal qureshi28-Oct-10 5:44 
GeneralRe: WPF perfomance Pin
AspDotNetDev3-Nov-10 7:03
protectorAspDotNetDev3-Nov-10 7:03 
AnswerRe: WPF perfomance Pin
Pete O'Hanlon28-Oct-10 7:13
subeditorPete O'Hanlon28-Oct-10 7:13 
AnswerRe: WPF perfomance Pin
venugopalm1-Nov-10 18:46
venugopalm1-Nov-10 18:46 
AnswerRe: WPF perfomance Pin
Nish Nishant3-Nov-10 9:38
sitebuilderNish Nishant3-Nov-10 9:38 

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.