2012-07-31 4 views
0

C 소스 코드를 편집하려고합니다. WPF로 양식을 쓰고 그 중에서도 속성을 직접 선언하지는 않지만 아래 참조가 사용됩니다. WPF 양식.wpf 리소스를 참조하는 코드

<Grid> 
    <StackPanel> 
     <Label> 
      <LocText ResourceIdentifierKey="CustomerName" Suffix=":"/> 
     </Label> 
     <TextBox HorizontalAlignment="Left" MinWidth="200" Text="{Binding Name}" /> 
     <Label> 
      <LocText ResourceIdentifierKey="GroupCode" Suffix=":"/> 
     </Label> 
     <ComboBox HorizontalAlignment="Left" MinWidth="150" Text="{Binding  GroupCode,Mode=TwoWay}" 
        ItemsSource="{Binding GroupCodes}" IsEditable="True"/> 
     <Label> 
      <LocText ResourceIdentifierKey="PhoneNumber" Suffix=":"/> 
     </Label> 
     <Common:MaskedTextBox HorizontalAlignment="Left" MinWidth="100" InputMask="{Binding PhoneNumberInputMask}" 
      PromptChar=" " UnmaskedText="{Binding PhoneNumber, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" /> 
     <Label> 
      <LocText ResourceIdentifierKey="Address" Suffix=":"/> 
     </Label> 
     <TextBox HorizontalAlignment="Left" MinWidth="200" MinHeight="55" Text="{Binding Address}" 
      AcceptsReturn="True" /> 
     <Label> 
      <LocText ResourceIdentifierKey="Note" Suffix=":"/> 
     </Label> 
     <TextBox HorizontalAlignment="Left" MinWidth="200" MinHeight="55" Text="{Binding Note}" 
      AcceptsReturn="True" /> 
     <CheckBox Margin="0,5,0,0" IsChecked="{Binding InternalAccount}"> 
      <LocText ResourceIdentifierKey="InternalAccount"/> 
     </CheckBox> 
     <Button HorizontalAlignment="Left" Margin="0,10" MinWidth="70" Content="{Binding SaveCommand.Caption}" 
      Command="{Binding SaveCommand}" /> 
     <Label Content="{Binding Error}" Foreground="Red" /> 
    </StackPanel> 
</Grid> 

속성을 편집하려면 어떻게해야합니까?

예를 들어, Lable의 내용을 변경하고 싶습니다.

+0

문제는 무엇입니까? 소스 코드를 편집하는 방법? 키보드로 :) 또는 어떻게 표시하는 대신 사용자가 일부 텍스트를 편집하게 할 수 있습니까? 아니면 다른가? – dvvrd

답변

0

당신이 묻는 것을 아는 것이 어렵습니다. 소스 코드를 편집하려면 Visual Studio에서 파일을로드하고 입력하십시오.

런타임에 Label의 내용을 변경하려면 두 가지 방법이 있습니다.

하나는 폼/usercontrol과 연결된 DataContext 개체의 속성에 레이블을 연결하기 위해 Binding을 사용하는 것입니다.

다른 레이블을 실제 이름을 부여하는 것입니다 :

<Label x:Name="showAccountError Foreground="Red"/> 

를 한 다음 코드의 내용 설정할 수 있습니다

showAccountError.Content = "Sample error"; 
관련 문제