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
90
Some problems with GroupByArea
posted

I have some strange problems with the GroupByArea in the xamDataGrid. First I tried to change the colors in the GroupByArea with following commands in the xamDataGrid.Resources

<LinearGradientBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, GroupByBackground}" StartPoint="0,0" EndPoint="0,1"  PresentationOptions:Freeze="true">
       <GradientStop Color="DarkSeaGreen" Offset="0"/>
       <GradientStop Offset="1">
              <GradientStop.Color>
                     <Color A="255" R="35" G="69" B="36"/>
               </GradientStop.Color>
       </GradientStop>
</LinearGradientBrush>

or 

 <SolidColorBrush x:Key="{x:Static igDP:DataPresenterBrushKeys.GroupByBackgroundKey}" Color="Red" />

Nothing happened, even with other GroupByArea-Keys.

 

So I settled for using the grey GroupByArea in the Onyx Theme, but then the next problems occured. When I set Theme to Onyx in XAML, the GroupByArea is displayed in the default blue, only when I set Theme to Onyx in the C# - Code Behind with

 ThemeManager.SetTheme(xamDataGrid1, "Onyx");

the GroupByArea is displayed in grey. Next problem is, when I try to change its prompts, because they need to be in German language

 <Window.Resources>
        <Style x:Key="grpStyle" TargetType="{x:Type igDP:GroupByArea}">
            <Setter Property="Prompt1" Value="Gruppieren"/>
            <Setter Property="Prompt2" Value="Hierher ziehen"/>
        </Style>
 </Window.Resources>

 <igDP:XamDataGrid DockPanel.Dock="Top" Name="xamDataGrid1" Width="Auto" Height="Auto" BorderThickness="2" GroupByAreaStyle="{StaticResource grpStyle}">

the prompts are changed, but the GroupByArea is blue again.

I have no idea to deal these problems, please tell me, what i´ve done wrong.

 

Greetz Frank

Parents
  • 69686
    Verified Answer
    posted

     Hello Frank,

    Customizing the GroupByArea is an easy task to accomplish -- there is a great example in the XamFeatureBrowser in the XamDataGrid - Themes and Custom Styles - Custom GroupByArea Style. The default styles of all the controls parts you can find in the local directory on your computer:

    "~\Infragistics\NetAdvantage for WPF 2008 Vol. 2\DefaultStyles" where you can get the base style and build your own.

    Here is a simpel style:

    <Style x:Key="MyCustomGroupByArea" TargetType="{x:Type igDP:GroupByArea}">
                    <Setter Property="FontSize" Value="12"/>
                    <Setter Property="Foreground" Value="#FFFFFF"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type igDP:GroupByArea}">
                                <ControlTemplate.Resources>
                                    <Storyboard x:Key="TurnOnInsertionPoint">
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PART_InsertionPoint" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                    <Storyboard x:Key="TurnOffInsertionPoint">
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PART_InsertionPoint" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </ControlTemplate.Resources>
                                <Grid x:Name="outerGrid" d:LayoutOverrides="Height">
                                    <Rectangle
                      Opacity="1"
                      Stroke="#FFBAB7B7"
                      StrokeThickness="0"
                      Width="Auto"
                      Height="Auto"
                      Margin="0,0,0,0">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0.575,0.986" StartPoint="0.575,-0.017">
                                                <GradientStop Color="#4C30245C" Offset="0"/>
                                                <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <StackPanel Orientation="Horizontal" Margin="6,12,0,0">
                                        <TextBlock
                                          x:Name="prompt1"
                                          FontSize="24"
                                          Text="Grupieren"
                                          Opacity=".5" />
                                        <TextBlock
                                          x:Name="prompt2"
                                          Opacity=".8"
                                          Margin="5,11.2,0,0"
                                          Text="Hierher ziehen" />

                                    </StackPanel>
                                    <!-- GroupedFieldLabelsArea-->
                                    <Grid
                      x:Name="PART_GroupedFieldLabelsArea"
                      Margin="0,12,0,0"
                      VerticalAlignment="Top"
                      d:IsLocked="True">
                                        <!-- GroupedFields List -->
                                        <igDP:GroupByAreaFieldListBox x:Name="GroupedFieldList" ItemsSource="{TemplateBinding GroupedFieldLabels}"/>
                                    </Grid>
                                    <!-- End GroupedFieldLabels Area -->
                                    <!-- AvailableFieldLabels Area -->
                                    <Grid
                      x:Name="PART_AvailableFieldLabelsArea"
                      Margin="0,49,0,15"
                      Visibility="Visible"
                      d:IsLocked="True">
                                        <!-- AvailableField List -->
                                        <igDP:GroupByAreaFieldListBox ItemsSource="{TemplateBinding AvailableFieldLabels}"/>
                                    </Grid>
                                    <!-- End AvailableFieldLabels Area -->
                                    <!-- Insertion Point -->
                                    <Polygon
                      x:Name="PART_InsertionPoint"
                      Opacity="0"
                      Fill="#FF151C55"
                      Points="0,0 10,0 5,5"
                      StrokeEndLineCap="Round"
                      StrokeStartLineCap="Round"
                      StrokeLineJoin="Round"
                      HorizontalAlignment="Left"
                      Margin="0,12,0,0"
                      VerticalAlignment="Top"/>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsExpanded" Value="True"/>
                                    <EventTrigger RoutedEvent="igDP:GroupByArea.ShowInsertionPoint">
                                        <EventTrigger.Actions>
                                            <BeginStoryboard x:Name="TurnOnInsertionPoint_BeginStoryboard" Storyboard="{StaticResource TurnOnInsertionPoint}"/>
                                        </EventTrigger.Actions>
                                    </EventTrigger>
                                    <EventTrigger RoutedEvent="igDP:GroupByArea.HideInsertionPoint">
                                        <EventTrigger.Actions>
                                            <BeginStoryboard x:Name="TurnOffInsertionPoint_BeginStoryboard" Storyboard="{StaticResource TurnOffInsertionPoint}"/>
                                        </EventTrigger.Actions>
                                    </EventTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

     

            <igDP:XamDataGrid Theme="Onyx"  Name="xamDataGrid1" GroupByAreaStyle="{StaticResource MyCustomGroupByArea}" >

    Concerning the theme, I set the theme through xaml and code bihind and it is working just fine as you can see in the screenshot. I do not know where the problem might be.

    Hope this helps. 

Reply Children