This question is locked. New answers and comments are not allowed.
I have a cellstyle defined as defined below:
However, you notice it is using an object called "Slot2" to bind. Since I need to do this for 5 additional columns (Slot1, Slot2, Slot3, Slot4, Slot5) I don't want to recreate this cellstyle every time just to set the Binding. Every column will be bound to the same nested fields but the Object names will be different. Any suggestions?
Thanks
| <Style x:Key="DayViewCellStyle1" TargetType="gridview:GridViewCell"> |
| <Setter Property="Template"> |
| <Setter.Value> |
| <ControlTemplate TargetType="gridview:GridViewCell"> |
| <Border x:Name="GridViewCellBorder" |
| BorderThickness="{TemplateBinding BorderThickness}" |
| BorderBrush="{TemplateBinding BorderBrush}" |
| Background="{TemplateBinding Background}"> |
| <Grid x:Name="GridViewCellGrid"> |
| <gridview:AlignmentContentPresenter x:Name="PART_ContentPresenter" TextAlignment="Center" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" HorizontalAlignment="Stretch" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Visibility="Collapsed"/> |
| <StackPanel Orientation="Vertical" Margin="3"> |
| <TextBlock Text="{Binding Slot2.CustomerName}"></TextBlock> |
| <TextBlock Text="{Binding Slot2.CaseId}"></TextBlock> |
| <TextBlock Text="{Binding Slot2.ProblemCategory}"></TextBlock> |
| <TextBlock Text="{Binding Slot2.CustomerName}"></TextBlock> |
| </StackPanel> |
| <Rectangle Width="{TemplateBinding VerticalLineThickness}" Fill="{TemplateBinding VerticalLineFill}" HorizontalAlignment="Right" Visibility="{TemplateBinding VerticalLineVisibility}"/> |
| <Rectangle Width="Auto" Height="Auto" x:Name="therect" Margin="0" Visibility="Collapsed" Stroke="#FFFFAB3F" StrokeThickness="2" /> |
| <Rectangle Width="Auto" Height="Auto" x:Name="CurrentBorder" Margin="2" Visibility="Collapsed" Stroke="#FF000000" StrokeThickness="1" StrokeDashOffset="0" StrokeDashCap="Square" StrokeDashArray="2"/> |
| </Grid> |
| <VisualStateManager.VisualStateGroups> |
| <VisualStateGroup x:Name="EditingStates"> |
| <VisualState x:Name="Normal"> |
| <Storyboard> |
| <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" |
| Storyboard.TargetProperty="Visibility"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" /> |
| </ObjectAnimationUsingKeyFrames>--> |
| <ObjectAnimationUsingKeyFrames Storyboard.TargetName="therect" |
| Storyboard.TargetProperty="Visibility"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed" /> |
| </ObjectAnimationUsingKeyFrames> |
| <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentBorder" |
| Storyboard.TargetProperty="Visibility"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed" /> |
| </ObjectAnimationUsingKeyFrames> |
| </Storyboard> |
| </VisualState> |
| <VisualState x:Name="Current"> |
| <Storyboard> |
| <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" |
| Storyboard.TargetProperty="Visibility"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" /> |
| </ObjectAnimationUsingKeyFrames>--> |
| <ObjectAnimationUsingKeyFrames Storyboard.TargetName="therect" |
| Storyboard.TargetProperty="Visibility"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed" /> |
| </ObjectAnimationUsingKeyFrames> |
| <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentBorder" |
| Storyboard.TargetProperty="Visibility"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed" /> |
| </ObjectAnimationUsingKeyFrames> |
| <!--Cell background is set to orange when a cell is current--> |
| <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GridViewCellBorder" |
| Storyboard.TargetProperty="Background"> |
| <DiscreteObjectKeyFrame KeyTime="0:0:0" > |
| <DiscreteObjectKeyFrame.Value> |
| <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
| <GradientStop Color="#FFFFD9AA" Offset="1"/> |
| <GradientStop Color="#FFFFAB3F" Offset="0"/> |
| </LinearGradientBrush> |
| </DiscreteObjectKeyFrame.Value> |
| </DiscreteObjectKeyFrame> |
| </ObjectAnimationUsingKeyFrames> |
| </Storyboard> |
| </VisualState> |
| </VisualStateGroup> |
| </VisualStateManager.VisualStateGroups> |
| </Border> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| </Style> |
However, you notice it is using an object called "Slot2" to bind. Since I need to do this for 5 additional columns (Slot1, Slot2, Slot3, Slot4, Slot5) I don't want to recreate this cellstyle every time just to set the Binding. Every column will be bound to the same nested fields but the Object names will be different. Any suggestions?
Thanks