Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
Custom Expandable Field Record Presenter Style
posted

Hello,

I'm trying to achieve a similar result as in your xamFeatureBrowser tutorial for the "Custom Expandable Field Record Presenter Style".

There are a few differences between what is my code and what you use in that tutorial:

1. I am generating the Grid fields automatically.

2. I'm getting the data for the grid from .txt file

The issue I'm cannot understand is once I use your code:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<

 

 

 

igDP:XamDataGrid x:Name="testGrid" DataSource="{Binding TestFeedData

}" >

 

 

 

 

 

<igDP:XamDataGrid.Resources

>

 

 

 

 

 

<!-- You can use the FieldChooserButtonStyleKey to change the way the field chooser button

in the data presenter looks.-->

 

 

 

 

 

<Style x:Key="{x:Type igDP:FieldChooser}" TargetType="{x:Type igDP:FieldChooser

}">

 

 

 

 

 

<Style.Resources

>

 

 

 

 

 

<!--FieldChooserEntry represents a field in the field chooser. This data template shows

the checkbox inside the label presenter instead of the default which is show it left of

the label presenter.-->

 

 

 

 

 

<DataTemplate DataType="{x:Type igDP:FieldChooserEntry

}">

 

 

 

 

 

<Grid

>

 

 

 

 

 

<igDP:LabelPresenter x:Name="label" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Field="{Binding Path=Field}" IsInFieldChooser="true" IsSelectedInFieldChooser="{Binding Path=IsSelected}" Padding

="30,7,2,7">

 

 

 

 

 

<igDP:LabelPresenter.Style

>

 

 

 

 

 

<Style TargetType="{x:Type igDP:LabelPresenter

}">

 

 

 

 

 

<Setter Property="BorderBrush" Value

="#FF333333"/>

 

 

 

 

 

<Setter Property="Foreground" Value

="#FFFFFFFF"/>

 

 

 

 

 

<Setter Property

="Background">

 

 

 

 

 

<Setter.Value

>

 

 

 

 

 

<LinearGradientBrush StartPoint="0.49,-0.00" EndPoint

="0.49,0.99">

 

 

 

 

 

<LinearGradientBrush.GradientStops

>

 

 

 

 

 

<GradientStopCollection

>

 

 

 

 

 

<GradientStop Offset="0" Color

="#FF595959"/>

 

 

 

 

 

<GradientStop Offset="0.99" Color

="#FF424242"/>

 

 

 

 

 

</GradientStopCollection

>

 

 

 

 

 

</LinearGradientBrush.GradientStops

>

 

 

 

 

 

</LinearGradientBrush

>

 

 

 

 

 

</Setter.Value

>

 

 

 

 

 

</Setter

>

 

 

 

 

 

<Setter Property

="Template">

 

 

 

 

 

<Setter.Value

>

 

 

 

 

 

<ControlTemplate TargetType="{x:Type igDP:LabelPresenter

}">

 

 

 

 

 

<Grid

>

 

 

 

 

 

<Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" SnapsToDevicePixels

="True" />

 

 

 

 

 

<Rectangle x:Name="Highlight" Height="1" Margin="1" VerticalAlignment="Top" Stroke="#838383" SnapsToDevicePixels="True" StrokeThickness

="1"/>

 

 

 

 

 

<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="{TemplateBinding Padding

}" >

 

 

 

 

 

</ContentPresenter

>

 

 

 

 

 

</Grid

>

 

 

 

 

 

<ControlTemplate.Triggers

>

 

 

 

 

 

<Trigger Property="IsMouseOver" Value

="True">

 

 

 

 

 

<Setter Property="Cursor" Value

="Hand"/>

 

 

 

 

 

<Setter Property

="Background">

 

 

 

 

 

<Setter.Value

>

 

 

 

 

 

<LinearGradientBrush StartPoint="0.47,-0.17" EndPoint

="0.47,2.04">

 

 

 

 

 

<LinearGradientBrush.GradientStops

>

 

 

 

 

 

<GradientStopCollection

>

 

 

 

 

 

<GradientStop Offset="0" Color

="#FF333333"/>

 

 

 

 

 

<GradientStop Offset="0.98" Color

="#FFffffff"/>

 

 

 

 

 

</GradientStopCollection

>

 

 

 

 

 

</LinearGradientBrush.GradientStops

>

 

 

 

 

 

</LinearGradientBrush

>

 

 

 

 

 

</Setter.Value

>

 

 

 

 

 

</Setter

>

 

 

 

 

 

</Trigger

>

 

 

 

 

 

<Trigger Property="IsSelectedInFieldChooser" Value

="True">

 

 

 

 

 

<Setter Property

="Background">

 

 

 

 

 

<Setter.Value

>

 

 

 

 

 

<LinearGradientBrush StartPoint="0.49,-0.00" EndPoint

="0.49,0.99">

 

 

 

 

 

<LinearGradientBrush.GradientStops

>

 

 

 

 

 

<GradientStopCollection

>

 

 

 

 

 

<GradientStop Offset="0" Color

="#FF8504bb"/>

 

 

 

 

 

<GradientStop Offset="0.99" Color

="#FF190124"/>

 

 

 

 

 

</GradientStopCollection

>

 

 

 

 

 

</LinearGradientBrush.GradientStops

>

 

 

 

 

 

</LinearGradientBrush

>

 

 

 

 

 

</Setter.Value

>

 

 

 

 

 

</Setter

>

 

 

 

 

 

<Setter TargetName="Highlight" Property="Stroke" Value

="#59FFFFFF"/>

 

 

 

 

 

</Trigger

>

 

 

 

 

 

</ControlTemplate.Triggers

>

 

 

 

 

 

</ControlTemplate

>

 

 

 

 

 

</Setter.Value

>

 

 

 

 

 

</Setter

>

 

 

 

 

 

</Style

>

 

 

 

 

 

</igDP:LabelPresenter.Style

>

 

 

 

 

 

<!--This is for toggling the visibility of a field by double clicking on it in the field chooser.-->

 

 

 

 

 

<igDP:LabelPresenter.InputBindings

>

 

 

 

 

 

<MouseBinding Command="{x:Static igDP:FieldChooserCommands.ToggleVisibility}" MouseAction

="LeftDoubleClick"/>

 

 

 

 

 

</igDP:LabelPresenter.InputBindings

>

 

 

 

 

 

</igDP:LabelPresenter

>

 

 

 

 

 

<Editors:XamCheckEditor x:Name="checkBox" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" IsThreeState="false" Value="{Binding Path=IsVisible, Mode

=TwoWay}"/>

 

 

 

 

 

</Grid

>

 

 

 

 

 

<DataTemplate.Triggers

>

 

 

 

 

 

<DataTrigger Binding="{Binding Path=IsVisible}" Value

="False">

 

 

 

 

 

<Setter TargetName="label" Property

="Background">

 

 

 

 

 

<Setter.Value

>

 

 

 

 

 

<LinearGradientBrush StartPoint="0.48,-0.82" EndPoint

="0.48,1.28">

 

 

 

 

 

<LinearGradientBrush.GradientStops

>

 

 

 

 

 

<GradientStopCollection

>

 

 

 

 

 

<GradientStop Offset="0" Color

="#FF999999"/>

 

 

 

 

 

<GradientStop Offset="0.99" Color

="#FFffffff"/>

 

 

 

 

 

</GradientStopCollection

>

 

 

 

 

 

</LinearGradientBrush.GradientStops

>

 

 

 

 

 

</LinearGradientBrush

>

 

 

 

 

 

</Setter.Value

>

 

 

 

 

 

</Setter

>

 

 

 

 

 

<Setter TargetName="label" Property="Foreground" Value

="#FF333333"/>

 

 

 

 

 

</DataTrigger

>

 

 

 

 

 

</DataTemplate.Triggers

>

 

 

 

 

 

</DataTemplate

>

 

 

 

 

 

</Style.Resources

>

 

 

 

 

 

<Style.Triggers

>

 

 

 

 

 

<!-- You can show some kind of visual queue when the user drags a field from the field chooser by

using IsDraggingItem property.-->

 

 

 

 

 

<Trigger Property="IsDraggingItem" Value

="true">

 

 

 

 

 

<Setter Property="BorderThickness" Value

="2"/>

 

 

 

 

 

<Setter Property="BorderBrush" Value

="Blue"/>

 

 

 

 

 

</Trigger

>

 

 

 

 

 

<!-- You can show some kind of visual queue when the user drags a field from the data presenter

using the IsDraggingItemFromDataPresenter property.-->

 

 

 

 

 

<Trigger Property="IsDraggingItemFromDataPresenter" Value

="true">

 

 

 

 

 

<Setter Property="BorderThickness" Value

="2"/>

 

 

 

 

 

<Setter Property="BorderBrush" Value

="Gray"/>

 

 

 

 

 

</Trigger

>

 

 

 

 

 

<!-- You can show some kind of visual queue when the user drags a field from the data presenter

and moves it over the field chooser by using the IsDragItemOver property.-->

 

 

 

 

 

<Trigger Property="IsDragItemOver" Value

="true">

 

 

 

 

 

<Setter Property="BorderThickness" Value

="2"/>

 

 

 

 

 

<Setter Property="BorderBrush" Value

="Green"/>

 

 

 

 

 

</Trigger

>

 

 

 

 

 

</Style.Triggers

>

 

 

 

 

 

</Style

>

 

 

 

 

 

</igDP:XamDataGrid.Resources

>

 

 

 

 

 

<igDP:XamDataGrid.FieldLayoutSettings

>

 

 

 

 

 

<igDP:FieldLayoutSettings AutoGenerateFields="False"  AllowClipboardOperations="Copy" HighlightAlternateRecords="True" AutoFitMode="Never" GroupBySummaryDisplayMode

="Text"/>

 

 

 

 

 

</igDP:XamDataGrid.FieldLayoutSettings

>

 

 

 

 

 

<igDP:XamDataGrid.FieldLayouts

>

 

 

 

 

 

<igDP:FieldLayout Key="Layout" IsDefault="True">

 

 

 

 

<!--<igDP:FieldLayout.SortedFields>

<igDP:FieldSortDescription FieldName="ToADD" Direction="Descending" IsGroupBy="True" />

</igDP:FieldLayout.SortedFields>-->

 

 

 

 

 

<igDP:FieldLayout.FieldSettings

>

 

 

 

 

 

<igDP:FieldSettings AllowSummaries="True" SummaryUIType="MultiSelect" SummaryDisplayArea

="InGroupByRecords,Bottom"/>

 

 

 

 

 

 

</igDP:FieldLayout.FieldSettings

>

 

 

 

 

 

<igDP:FieldLayout.Fields

>

 

 

 

 

 

<igDP:Field Name="testField" Label

="Test Field" >

 

 

 

 

 

<igDP:Field.Settings

>

 

 

 

 

 

<igDP:FieldSettings AllowEdit

="False"/>

 

 

 

 

 

</igDP:Field.Settings

>

 

 

 

 

 

</igDP:Field

 

>

 

 

 

</igDP:FieldLayout.Fields

>

 

 

 

 

 

</igDP:FieldLayout

>

 

 

 

 

 

</igDP:XamDataGrid.FieldLayouts

>

 

 

 

 

 

 

 

 

 

 

</igDP:XamDataGrid

>

 

 

 

 

 

</Grid

>

</

 

 

 

UserControl

>

 

 

 

The issue is that it doesn't show me the menu to choose the fields that  I want to be shown. In the xaml file it tells me :

Resource{x:Type Infragistics.Windows.DataPresenter.FieldChooser} is never used.

My question is how can I make it work since I'm basically following your steps from the tutorial and it shows me the above error and doesn't show me the menu on the left hand side of the View. It does show me the Grid I have but not with the menu.

I am looking forward to hearing from you!

Regards,

  • 138253
    Offline posted

    Hello,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

  • 138253
    Offline posted

    Hello,

    Thank you for your post. I have been looking into it and I created a sample project for you using the code you have provided and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.

    Looking forward for your reply.

    XamDataGridCustomFiedlChooser.zip