2012-08-22 2 views
0

질문이 2 개 있습니다.XAML에서 Run Object 실행

첫 번째. Windows 7 용 Silverlight를 사용하고 있으며 바인딩에 문제가 있습니다.

내가 내가 ModeValue의 TextBlock의 바인딩 TemplateBinding을 사용하여이

<Style TargetType="RadioButton" x:Key="VoltageTab"> 
    <Setter Property="Width" Value="95"/> 
    <Setter Property="Height" Value="61"/> 
    <Setter Property="Margin" Value="193,0,192,3"/> 
    <Setter Property="HorizontalAlignment" Value="Left"/> 
    <Setter Property="VerticalAlignment" Value="Bottom"/> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="RadioButton"> 
        <Grid Background="#00000000"> 
          <Image x:Name="UnCheckedimg" Source="12.png"/> 
          <Image x:Name="Checkedimg" Visibility="Collapsed" Source="11.png"/> 
          <TextBlock x:Name="ModeName" FontSize="20" FontFamily="Alternate_Gothic_No.ttf#Alternate-Gothic-No3" Text="VOLTAGE" Foreground="#D25A32" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,4,0,0" /> 
          <TextBlock x:Name="ModeValue" FontSize="20" FontFamily="Alternate_Gothic_No.ttf#Alternate-Gothic-No3" Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,2"/> 
          <TextBlock x:Name="ModeNameChecked" Visibility="Collapsed" FontSize="34" FontFamily="Alternate_Gothic_No.ttf#Alternate-Gothic-No3" Text="VOLTAGE" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" /> 
        </Grid> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 

같은 템플릿을 가지고,하지만 난 다른 ModeName을 바인딩 바인딩 필요가 없다. 언젠가는 어떻게 할 수 있겠습니까? 난 경우 나 alowe 편집기 didnt 한이 여기에 게시 할 수 있기 때문에 2 스타일이 아래에 게시

그것은 확인을 작동합니다

내가 다른 스타일을 가지고
  • 편집은

      단지 텍스트를 내용으로 집어 넣지 만, 버튼 안에 텍스트를 포맷 할 수 있도록 객체를 실행하고 싶습니다.

      이것이 가능한가요? 그렇지 않다면 이것을 달성 할 다른 방법이 있습니까?

      Windows 용 Silverlight를 사용한다는 점에 유의하십시오.

      안부, 루카 easyer 표현


      <Style x:Key="FunctionSelectButton" TargetType="RadioButton"> 
          <Setter Property="Width" Value="154"/> 
          <Setter Property="Height" Value="61"/> 
           <Setter Property="Template"> 
            <Setter.Value> 
             <ControlTemplate TargetType="RadioButton"> 
              <Grid Background="#00000000"> 
               <Image x:Name="NormalImg" Source="mode_unpressed.png" Stretch="None"/> 
               <TextBlock x:Name="NormalText" Foreground="#D25A32" FontSize="26" FontFamily="Alternate_Gothic_No.ttf#Alternate-Gothic-No3" HorizontalAlignment="Center" Text="{TemplateBinding Content}" VerticalAlignment="Center" Margin="0,0,0,0"></TextBlock> 
              </Grid> 
             </ControlTemplate> 
            </Setter.Value> 
           </Setter> 
          </Style> 
      

      이미지 ->Image

    +0

    야 루카, 나는 문제가 당신이 요구하는지하지만 어쩌면 짧은을 할 수 있는지 이해하는 데 네가 원하는 것을 그림으로 표현하면 더 잘 묘사 할 수 있을까? –

    +0

    나는 그림을 그렸다, 나는 그 것이 더 분명 할 것이기를 바란다. –

    답변

    1

    첫 번째 질문, look here 대답합니다.

    두 번째 질문에도 불구하고 나는 그 질문이 무엇인지 완전히 이해하고 있지는 않지만, 당신이 찾고있는 것은 ContentTemplate이있는 ContentPresenter로 설정하는 것입니다.


    <Button Content="{Binding RPE-2WIRE}" Style="{StaticResource FunctionSelectButton}" FontFamily="Alternate_Gothic_No.ttf#Alternate-Gothic-No3" Foreground="#D25A32" FontSize="26" /> 
    

    <Style x:Key="FunctionSelectButton" TargetType="RadioButton"> 
        <Setter Property="Width" Value="154"/> 
        <Setter Property="Height" Value="61"/> 
         <Setter Property="Template"> 
          <Setter.Value> 
           <ControlTemplate TargetType="RadioButton"> 
            <Grid> 
             <Image x:Name="NormalImg" Source="mode_unpressed.png" Stretch="None"/> 
             <ContentPresenter x:Name="contentPresenter" 
                  Margin="{TemplateBinding Padding}" 
                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                  Content="{TemplateBinding Content}" 
                  ContentTemplate="{TemplateBinding ContentTemplate}" /> 
    
    <!-- 
    <TextBlock x:Name="NormalText" Foreground="#D25A32" FontSize="26" FontFamily="Alternate_Gothic_No.ttf#Alternate-Gothic-No3" HorizontalAlignment="Center" Text="{TemplateBinding Content}" VerticalAlignment="Center" Margin="0,0,0,0"></TextBlock> 
    --> 
             </Grid> 
            </ControlTemplate> 
           </Setter.Value> 
          </Setter> 
         </Style> 
    
    는 적어도 그게 내가 당신이 :)을 말을하는지 무엇을 생각

    +0

    안녕하세요, 저는 8 시간 동안 의존성 프리스 티즈가 성공하지 못하게하는 방법을 알아 냈습니다. (Chris는 연락 할 수있는 방법이 있습니까? 내 이메일 : luka.pivk [at] avspekter.si 또는 skype : vevrcaa 만약 당신이 나를 조금 도와 주려고한다면, Luka –

    +0

    두 번째 질문에 관해서는, 당신의 솔루션 인 TNX를 사용하여 해결했습니다. –

    +0

    이메일을 보내고, 일을 마치고 이야기 할 수 있습니다. –