'WPF'에 해당되는 글 1건

.NetFrame 4.5 working tip

WPF 2013.06.12 13:30

4.5에서만 되는 부분은 아니라도 참고 사항 정리

(Silverlight, Store app xaml과의 다른 점)

 

1. ResourceDictionary에 있는 ItemTemplate에 Command binding 방법

실버라이트와 Store app의 xaml과는 다른 방법으로 바인딩을 하는군요..

찾는데 약 1시간 정고 걸린듯..

 

    <DataTemplate x:Key="TGroupItemTemplate">
        <Grid d:DesignWidth="180" d:DesignHeight="50" Margin="5">
            <telerik:RadRadioButton Content="{Binding NM_TGROUP}" Padding="0,5,0,5" Height="50"
                               Command="{Binding DataContext.TGroupClickCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
                               CommandParameter="{Binding CD_TGROUP}" GroupName="{Binding CD_IDNUM}" IsChecked="{Binding IsChecked, Mode=TwoWay}"
                               IsEnabled="{Binding FG_USE, ConverterParameter=0|nor, Converter={StaticResource AnyDataToBoolConverter}}" />
        </Grid>
    </DataTemplate>

 

2. DynamicResource

스타일을 잡아서 사용하는데 StaticResource가 아닌 DynamicResource로 표현이 되는..

이것도 역시 다른 넘들이랑 다르군요

 

            <Border Grid.Column="3" Style="{DynamicResource GrayBorderStyle}">
                <TextBlock Text="*사용자" VerticalAlignment="Center" />
            </Border>

 

3. EventToCommandBehavior

커맨드를 사용할 때 커맨드 파라메터로 args를 넘겨주는 Behavior

잘 동작함, 커맨드는 자신이 사용하는 커맨드를 그냥 사용해도 됨

 

원본링크

http://stackoverflow.com/questions/6205472/mvvm-passing-eventargs-as-command-parameter

 

참고소스(적용)

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

xmlns:b="clr-namespace:Sample.Behaviors"

 

            <Frame x:Name="frameMain" NavigationUIVisibility="Hidden" >
                <i:Interaction.Behaviors>
                    <b:EventToCommandBehavior Event="Navigated" Command="{Binding NavigatedCommand}" PassArguments="True"/>
                    <b:EventToCommandBehavior Event="NavigationFailed" Command="{Binding NavigationFailedCommand}" PassArguments="True"/>
                    <b:EventToCommandBehavior Event="Navigating" Command="{Binding NavigatingCommand}" PassArguments="True"/>
                </i:Interaction.Behaviors>
            </Frame>

 

4. Error: "The underlying provider failed on Open" in Entity Framework application

http://blogs.msdn.com/b/dataaccesstechnologies/archive/2012/08/09/error-quot-the-underlying-provider-failed-on-open-quot-in-entity-framework-application.aspx

User Instance=True;

 

The connection was not closed. The connection's current state is connecting

 

5. The context cannot be used while the model is being created

 

6. Non-static method requires a target.

Table에 데이터가 없을때 Getting을 이용해서 조회를 하면 나는 오류

 

7. EF error

An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.

 

'WPF' 카테고리의 다른 글

.NetFrame 4.5 working tip  (0) 2013.06.12
블로그 이미지

kaki104

/// Microsoft MVP - Windows Development - Apr 2014 ~ Mar 2018 /// email : kaki104@daum.net, twitter : @kaki104, facebook : https://www.facebook.com/kaki104 https://www.facebook.com/groups/w10app/

티스토리 툴바