バージョン

CellValuePresenterStyle プロパティ (FieldSettings)

CellValuePresenter のスタイル
シンタックス
'宣言
 
Public Property CellValuePresenterStyle As Style
public Style CellValuePresenterStyle {get; set;}
解説

コントロールのスタイル方法の説明については開発者ガイドの「xamDataGrid、xamDataCarousel および xamDataPresenter スタイリング ポイントで作業する」を参照してください。

使用例
The following example demonstrates how to associate a custom Style for a particular field using the CellValuePresenterStyle of the Settings. In this example, there are 2 custom CellValuePresenter styles. One is set up to use a custom style that uses a Button for the template of each cell. The other uses a Hyperlink for the template of the cell. Note, you will need to handle the routed events for these objects (e.g. Button.Click and Hyperlink.RequestNavigate).
<igDP:XamDataGrid BindToSampleData="True">

    
<igDP:XamDataGrid.Resources>
        
<!-- hyperlink cell -->
        
<!-- Note - you'll need to handle the routed Hyperlink.RequestNavigate to process the clicking on a link -->
        
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="hyperlinkCell">
            
<Setter Property="Template">
                
<Setter.Value>
                    
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        
<TextBlock Margin="{TemplateBinding Padding}">
                            
<Hyperlink NavigateUri="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}">
                                
<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"/>
                            
</Hyperlink>
                        
</TextBlock>
                    
</ControlTemplate>
                
</Setter.Value>
            
</Setter>
        
</Style>

        
<!-- button cell -->
        
<!-- Note - you will need to handle the routed Button.Click event  -->
        
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="buttonCell">
            
<Setter Property="Template">
                
<Setter.Value>
                    
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        
<Button Content="{TemplateBinding Content}" />
                    
</ControlTemplate>
                
</Setter.Value>
            
</Setter>
        
</Style>

    
</igDP:XamDataGrid.Resources>
    
    
<igDP:XamDataGrid.FieldLayouts>
        
<igDP:FieldLayout>
            
<igDP:FieldLayout.Fields>
                
<igDP:Field Name="name" />
                
<igDP:Field Name="department">
                    
<igDP:Field.Settings>
                        
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource buttonCell}"/>
                    
</igDP:Field.Settings>
                
</igDP:Field>
                
<igDP:Field Name="salary"/>
                
<igDP:Field Name="email">
                    
<igDP:Field.Settings>
                        
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource hyperlinkCell}"/>
                    
</igDP:Field.Settings>
                
</igDP:Field>

            
</igDP:FieldLayout.Fields>
        
</igDP:FieldLayout>
    
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
参照