반응형

반응형

<TextBlock Text={Binding RelativeSource={RelativeSource Self}, Path=FontFamily}" />

<TextBlock Text=" - "/>

<TextBlock Text="{Binding RelativeSource={RelativeSource Self}, Path=FontSize}"/>

<TextBlock Text=" pixels"/>

반응형

'WINDOWS PHONE' 카테고리의 다른 글

그달의 마지막날 구하기.  (0) 2012.09.14
LINQ 문자열 검색 SQL Like 같이 하기  (0) 2012.07.24
ConverterParameter 사용하기  (0) 2012.06.28
Binding의 속성 Path  (0) 2012.06.28
코드로 Binding 하기.  (0) 2012.06.27
Posted by 컴스터
,
반응형
public class StringFormatConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(targetType == typeof(string) && parameter is string)
     return String.Format(culture, parameter as string, value);

return value;
}
}

================ 사용하기 ===================

Text="{Binding ElementName=slider,

    Path=Value,

    Converter={StaticResource stringFormat},

    ConverterParameter='The slider is {0:F2}'}"



반응형

'WINDOWS PHONE' 카테고리의 다른 글

LINQ 문자열 검색 SQL Like 같이 하기  (0) 2012.07.24
RelativeSource 사용하기  (0) 2012.06.28
Binding의 속성 Path  (0) 2012.06.28
코드로 Binding 하기.  (0) 2012.06.27
DataTemplate를 이용한 버튼 예제.  (0) 2012.04.18
Posted by 컴스터
,
반응형

Path는 여러 속성 이름을 연결해서 쓸 수 있다.


컨트롤에 이름을 부여 하지 않고 컨트롤 상위로 접근하여 간접적으로 참조할 수 있다.


Text="{Binding ElementName=ContentPanel, Path=Children[0].Value}" 


혹은 시각적 트리에서 한 단계 더 올라갈 수도 있다.


Text={Binding ElementName=LayoutRoot, Path=Children[1].Children[0].Value}"


이렇게 속성과 인덱스를 마침표(.)로 연결하여 Path에 사용한다.

반응형

'WINDOWS PHONE' 카테고리의 다른 글

RelativeSource 사용하기  (0) 2012.06.28
ConverterParameter 사용하기  (0) 2012.06.28
코드로 Binding 하기.  (0) 2012.06.27
DataTemplate를 이용한 버튼 예제.  (0) 2012.04.18
ControlTemplate를 이용한 버튼 예제.  (0) 2012.04.17
Posted by 컴스터
,
반응형

using System.Windows.Data;  // 추가.



Binding binding = new Binding();                              // 바인딩 인스턴스 생성.
binding.ElementName = "slider";                               // 컨트롤 이름.
binding.Path = new PropertyPath("Value");                 // 바인딩 시킬 속성.

txtblk.SetBinding(TextBlock.TextProperty, binding);     // 텍스트 블럭에 슬라이드Value를 코드로 바인딩 함.


또는 BindingOperations.SetBinding(txtblk, TextBlock.TextProperty, binding);

반응형
Posted by 컴스터
,
반응형

<Button Width="160" Height="160" Content="버튼">
                <Button.ContentTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Ellipse Width="80" Height="80" Fill="Red"></Ellipse>
                            <TextBlock Text="{Binding}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </StackPanel>
                    </DataTemplate>
                </Button.ContentTemplate>
            </Button>

반응형
Posted by 컴스터
,
반응형

<Button Width="100" Height="100" Content="안녕하세요" FontSize="15" Click="Button_Click">
            <Button.Template>
                <ControlTemplate>
                    <Grid>
                        <Ellipse Width="100" Height="100">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="Blue"></GradientStop>
                                    <GradientStop Offset="1" Color="Red"></GradientStop>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <Ellipse Width="80" Height="80">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="White"></GradientStop>
                                    <GradientStop Offset="1" Color="Transparent"></GradientStop>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                </ControlTemplate>
            </Button.Template>
        </Button>

반응형
Posted by 컴스터
,
반응형

http://wptools.codeplex.com/releases/view/73232


Power Tools의 file browser 에서 해당 앱의 폴더 구조를 볼 수 있음.

반응형
Posted by 컴스터
,
반응형

http://msdn.microsoft.com/ko-kr/library/system.windows.input.inputscopenamevalue(v=VS.85).aspx



======================= C# 코드 ==========================================

InputScope inputSope = new InputScope();

InputScopeName inputScopeName = new InputScopeName();

inputScopeName.NameValue = InputScopeNameValue.CurrencyAmount;

inputScope.Names.Add(inputScopeName);


txtbox.InputScope = inputScope;



======================== XAML 코드 =====================================

<TextBox>

<TextBox.InputScope>

<InputScope>

<InputScopeName NameValue="CurrencyAmount"/>

</InputScope>

</TextBox.InputScope>

</TextBox>

반응형
Posted by 컴스터
,
반응형

비관론자는 모든 기회 속에서 어려움을 찾아내고


낙관론자는 모든 어려움 속에서 기회를 찾아낸다.

A pessimist sees the difficulty in every opportunity;
an optimist sees the opportunity in every difficulty.

- 윈스턴 처칠(Winston Churchill)


삶이란 우리 인생 앞에 어떤 일이 생기느냐에 따라 결정되는 것이 아니라,
우리가 어떤 태도를 취하느냐에 따라 결정되는 것입니다.
운명보다 더 중요한 것이 그것을 바라보는 태도와 자세입니다.
태도와 자세에 따라 운명도 바뀌기 때문입니다.

Our lives are not determined by what happens to us,
but by how we decide to approach things.
The two things more important than fate are one’s mentality and demeanor
- as these are the qualities that can alter fate.

반응형
Posted by 컴스터
,
반응형

세상에서는 주로 낙관주의자들이 승리하는데,


그것은 그들이 항상 옳기 때문이 아니라 긍정적이기 때문이다.


그들은 잘못되었을 때조차도 긍정적이다.


이러한 태도는 성취, 향상 그리고 성공의 길로 연결된다.


교육을 받고 시야가 열려 있는 낙관주의는 그 대가를 얻는 것이다.


- 하버드대 경제사학자 데이비드 랜즈 교수


일찍이 칼린 지브란은 “낙관주의자는 장미에서 가시가 아니라 꽃을 보고,
비관주의자는 꽃은 망각하고 가시만 쳐다본다.”고 지적했습니다.
객관적으로 주어지는 환경은 누구에게나 같습니다.
그러나 어떤 사람은 그 속에서 긍정과 낙관을 보고,
또 다른 이는 부정과 비관을 보게 됩니다.
놀라운 것은 그가 보는 대로 이루어진다는 것입니다.

반응형
Posted by 컴스터
,


반응형