Hi,
I would like to add a custom view to my xamDataPresenter in order to display images in a WrapPanel.
So, I think that I must implement my own View (from ViewBase), but can you help me to acheive this ?
I have try, but the Records are not wrapped !
My XAML :
<vov:WrapView x:Key="ThumbnailsView"> </vov:WrapView>
Here is the class I use :
public class WrapView : Infragistics.Windows.DataPresenter.ViewBase { protected override CellPresentation CellPresentation { get { return CellPresentation.CardView; } } protected override FieldLayoutTemplateGenerator GetFieldLayoutTemplateGenerator(FieldLayout fieldLayout) { return new CardViewFieldLayoutTemplateGenerator(fieldLayout); } protected override bool HasLogicalOrientation { get { return true; } } protected override Type ItemsPanelType { get { return typeof(WrapPanel); } } // protected override Type RecordPresenterContainerType //{ // get // { // return base.RecordPresenterContainerType; // } //} protected override bool IsNestedPanelsSupported { get { return true; } } protected override bool IsFixedRecordsSupported { get { return true; } } }
Thanks,
For the custom panel :
public class WrapView : Infragistics.Windows.DataPresenter.ViewBase
{
get
}
Here is the dictionary I use:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vov="clr-namespace:ViewOn.UI.View"
xmlns:igDP="http://infragistics.com/DataPresenter"
<Style TargetType="{x:Type igDP:GroupByRecordPresenter}">
<Setter Property="Background" Value="#00FFFFFF" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type igDP:GroupByRecordPresenter}">
<Grid Background="{TemplateBinding Background}" Margin="10,10,10,10">
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Expansion Checkbox -->
<igWindows:ExpansionIndicator
x:Name="ExpansionIndicator"
Visibility="{TemplateBinding ExpansionIndicatorVisibility}"
<Grid x:Name="PART_RecordContentSite" Margin="0" Grid.Row="0" Grid.Column="1" Visibility="Collapsed">
<Border
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Width="Auto"
Height="Auto"
RenderTransformOrigin="0.5,0.5" CornerRadius="2,2,2,2"
SnapsToDevicePixels="True"
Background="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelBackground}}"
>
<Rectangle Stroke="#44000000" StrokeThickness="1" RadiusX="1.55015910897703" RadiusY="1.55015910897703" Fill="Transparent" />
</Grid>
<!-- End Added 8/1/2006 GH -->
x:Name="highlight"
CornerRadius="2,2,2,2"
Background="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelHighlight}}"
<!-- End Add 8/1/2006 GH-->
<ContentControl
Style="{StaticResource LabelContentStyle}"
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(igDP:RecordPresenter.Record).Description}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
<Grid x:Name="PART_NestedContentSite" Grid.Row="1" Grid.Column="1" Visibility="Collapsed">
CornerRadius="0,0,3,3"
BorderBrush="#44102975"
<Border.Background>
<GradientStop Color="#FFFFFFFF" Offset="0.25" />
</LinearGradientBrush>
</Border>
The namescope was broken because the recordlistcontrol was not in the logical tree. We
x:Name="NestedContentPresenter"
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NestedContent}"
Margin="0,0,0,5"
/>
<ControlTemplate.Resources>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="ncpVisual"
Storyboard.TargetProperty="Opacity"
<DiscreteDoubleKeyFrame Value="0" KeyTime="00:00:00" />
<SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="1" KeyTime="00:00:0.75" />
<ObjectAnimationUsingKeyFrames
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="00:00:00"/>
</ObjectAnimationUsingKeyFrames>
Storyboard.TargetName="ncpMask"
<Storyboard x:Key="sbHideNested">
Storyboard.TargetName="NestedContentPresenter"
<SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="1" KeyTime="00:00:00.15" />
</Storyboard>
<ControlTemplate.Triggers>
<Setter TargetName="PART_RecordContentSite" Property="Visibility" Value="Visible" />
<Trigger Property="ShouldDisplayGroupByRecordContent" Value="false">
</Trigger>
<MultiTrigger.Conditions>
<Condition Property="ShouldDisplayGroupByRecordContent" Value="false"/>
<Setter TargetName="ExpansionIndicator" Property="Grid.Row" Value="1" />
<Trigger Property="HasNestedContent" Value="true">
<Trigger.EnterActions>
<!--<StopStoryboard BeginStoryboardName="NestedOff" />-->
</ControlTemplate>
</Setter>
<Setter.Value>
<Grid Background="{TemplateBinding Background}">
<ColumnDefinition Width="*" MinWidth="20" />
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<!-- Record content site -->
<!-- Background Bar -->
<!-- End Background Bar -->
<Grid x:Name="PART_NestedContentSite" Grid.Row="1" Grid.Column="0" Visibility="Collapsed">
<Trigger Property="ShouldDisplayGroupByRecordContent" Value="true">
<Style TargetType="{x:Type igDP:ExpandableFieldRecordPresenter}">
<Setter Property="Margin" Value="0,0,0,5" />
<ControlTemplate TargetType="{x:Type igDP:ExpandableFieldRecordPresenter}">
<Grid Margin="10,10,10,10" Background="{TemplateBinding Background}">
<Grid x:Name="PART_RecordContentSite" Margin="0" Grid.Row="0" Grid.Column="1"
Name="borderBackground"
<Rectangle Stroke="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelOuterBorder}}" StrokeThickness="1" RadiusX="1.55015910897703" RadiusY="1.55015910897703" Fill="Transparent" />
x:Name="borderBackgroundHighlight"
<ContentPresenter
TextBlock.Foreground="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelForeground}}"
Margin="10,3,10,3"
<!-- Nested Content -->
BorderBrush="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, NestedContentBackgroundBorder}}"
BorderThickness="1"
need to use a ContentControl instead so the content is made a logical child. -->
Name="ncpVisual"
Opacity="0"
Margin="{TemplateBinding Padding}"
<Storyboard x:Key="sbDisplayNested">
<SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="0" KeyTime="00:00:00.15" />
<Setter TargetName="PART_NestedContentSite" Property="Visibility" Value="Visible" />
<BeginStoryboard Storyboard="{StaticResource sbDisplayNested}" x:Name="NestedOn"/>
</Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource sbHideNested}" x:Name="NestedOff" />
</Trigger.ExitActions>
<ColumnDefinition Width="*" />
<!-- Expandable Field Title -->
<Grid x:Name="PART_RecordContentSite" Margin="0" Grid.Row="0" Grid.Column="0"
</ControlTemplate.Triggers>
</Setter.Value>
</Style>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HeaderAreaBackground">
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0.5" Color="#FF424759"/>
<GradientStop Offset="1.000000" Color="#FF191925"/>
<Setter Property="NestedContentBackground" Value="Transparent" />
<Setter Property="Margin" Value="0,0,0,2" />
<igWindows:CardPanel x:Name="baseGrid" Background="{TemplateBinding Background}">
Visibility="Collapsed"
Background="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, AddRowBackground}}"
BorderBrush="#FFA9A9A9"
HorizontalAlignment="Stretch"
x:Name="addRowFooter"
VerticalAlignment="Stretch"
Width="Auto" Height="Auto"
<Border Background="Green">
<Grid.ColumnDefinitions>
Grid.Row="1"
Grid.Column="0"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ExpansionIndicatorVisibility}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsExpanded, Mode=TwoWay}"
<!-- Added 8/2/2006 GH -->
<Rectangle x:Name="fill" Margin="0,0,0,0" Fill="{TemplateBinding HeaderAreaBackground}" />
<Rectangle x:Name="darkLine" Fill="#66000000" VerticalAlignment="Top" Margin="0,0,0,0" Width="Auto" Height="1"/>
<!-- End Added 8/2/2006 GH -->
x:Name="PART_HeaderContentSite"
Grid.Row="0"
Grid.Column="1"
Content="{TemplateBinding HeaderContent}"
Visibility="Visible"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
<!-- Record Content -->
x:Name="PART_RecordContentSite"
Content="{TemplateBinding DataContext}"
ContentTemplate="{TemplateBinding RecordContentAreaTemplate}"
<Border x:Name="PART_NestedContentSite"
Grid.Row="2"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{TemplateBinding NestedContentBackground}"
Content="{TemplateBinding NestedContent}"
<Setter TargetName="PART_HeaderContentSite" Property="Grid.Row" Value="1" />
<Setter TargetName="PART_NestedContentSite" Property="Grid.Row" Value="1" />
<Setter TargetName="PART_RecordContentSite" Property="VerticalAlignment" Value="Top" />
<Setter TargetName="ExpansionIndicator" Property="Grid.Column" Value="1" />
<Setter TargetName="SpacerFill" Property="Grid.RowSpan" Value="3" />
<Trigger Property="ShouldDisplayRecordContent" Value="False">
<!--JJD 9/4/07 - BR26153 -->
<!--<Setter TargetName="ExpansionIndicator" Property="Visibility" Value="Hidden" />-->
<MultiTrigger>
<Condition Property="ShouldDisplayRecordContent" Value="False"/>
<Condition Property="ExpansionIndicatorVisibility" Value="Visible"/>
<Setter TargetName="ExpansionIndicator" Property="Visibility" Value="Hidden" />
<Condition Property="Orientation" Value="Horizontal"/>
</MultiTrigger.Conditions>
</MultiTrigger>
<Setter TargetName="ExpansionIndicator" Property="Grid.Row" Value="2" />
<Trigger Property="IsHeaderRecord" Value="True">
<!--Only set ExpansionIndicator Visibility to Hidden if is was Visible (see new MultiTrigger below) -->
<Setter TargetName="ExpansionIndicator" Property="Grid.Row" Value="0" />
<!--Only set ExpansionIndicator Visibility to Hidden if is was Visible -->
<Trigger Property="HasHeaderContent" Value="False">
<Setter Property="Visibility" TargetName="PART_HeaderContentSite" Value="Collapsed"/>
<Setter TargetName="baseGrid" Property="Background" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
<Trigger Property="HasNestedContent" Value="False">
<Setter Property="Visibility" TargetName="addRowFooter" Value="Visible"/>
<Setter Property="Margin" Value="0,2,0,0" />
<Rectangle Fill="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, CardBackground}}" />
</igWindows:CardPanel>
</ResourceDictionary>
If you use the gridview panel, you will see a "green" border, but if I use the WrapPanel it has no effect !!!!!
Can you help us please ?
Thanks a lot for your support
Do you have any solution for this problem ?
Thanks
Can someone help us ?
I does find any solution
It should be possible !
Please help....
Hi Joe,
I have try several combinations, but none work :-(
How can I access the DataRecord through binding, I have try {Binding Title} and some others, but no data is displayed !
You're right, thanks.
I have do what you say and it is better, but it sounds that having
<ContentPresenter x:Name="PART_RecordContentSite"/>
is mandatory, or it crash !
What I want :
- Display an image binded to a property of my datasource, say "CoverImage"
- a title binded to the "Title" property
- I must be able to double click on the title and rename it, like for GridView
Do you have an idea on how I can acheive this ?