Hello, in my DataPresenter i have a grid with many columns. My next step is to add a custom Header over a specific column. For example over the column Item there must be placed some Controls, like Textboxes. The reason why i must use this with the grid is, when i resize the column, all the textbox controls must depends on the column width. Is it possible to add a column index over the grid a Custom Header with some controls, which are depending with the column ??
It´s difficult to explain, you must see the Grid:
1: These is a panel with some specific control like labels and textboxes, these columns could be rise dynamically this means there could be minimal one or many columns. the Description column only describes the rows.
2: These colums bind data to the grid, each colum must be sortable, filterable, fixing the header.
3. That column part are depending on the header columns of 1 , when i resize this columns, the columns of 1 also muste resize.
4: in the Footer there is also a new panel with some Rows with descriptions and values.
The problem is, that the columns of 1, 3 and 4 are one unit with different values. These units could be created dynamically, depends on a collection.
So i hope you could give me an advice for the best solution.
The point 4 with the Description i solved with the SummaryDefinition with a Style:
The next step, i must set on the right side of the Description Summary new columns for the values.
My idea was, to define 2 Styles and assign the columns with the specific style. But i read in this post that is not possible to use Styles by Key with the SummaryDefinition.
Any idea to add new summary columns??
Hello, i have created the the rest of SummaryDefinitions for the Fields (Col1 - Col5) dynamically in the code:
<Style x:Name="FooterDescription" TargetType="{x:Type my:SummaryResultPresenter}"><Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type my:SummaryResultPresenter}"> <Grid> <Grid.RowDefinitions> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition> </Grid.RowDefinitions> <Label Content="Description 1" Grid.Column="0" Grid.Row="0"></Label> <Label Content="Description 2" Grid.Column="0" Grid.Row="1"></Label> <Label Content="Description 3" Grid.Column="0" Grid.Row="2"></Label> <Label Content="Description 4" Grid.Column="0" Grid.Row="3"></Label> <Label Content="Description 5" Grid.Column="0" Grid.Row="4"></Label> </Grid> </ControlTemplate> </Setter.Value></Setter></Style>
<my:FieldLayout x:Name="SummaryDescription"> <my:FieldLayout.SummaryDefinitions> <my:SummaryDefinition Position="Center" /> <!--<my:SummaryDefinition PositionFieldName="Col3" />--> </my:FieldLayout.SummaryDefinitions> </my:FieldLayout>private void SetSummaryToField(string fieldName) { SummaryDefinition summary = new SummaryDefinition(); summary.SourceFieldName = fieldName; summary.Key = fieldName; SummaryDescription.SummaryDefinitions.Add(summary);}The red marked SummaryDefinition is set by Position="Center"because, when i resize the columns width of RW|Col1 the text of the summary does not hide and it is not bound to one Column. On the picture you can see, that the SummaryDefinition is visible over the columns.Problem 1: How can i put these SummaryDefinition on the same height like the others? When i set the specific Position for this SummaryDefinition, the described resizing doesn´t work!Problem 2: The other SummaryDefinition are set dynamically, but how to set other Styles for SummaryDefinitions of Col1 - Col5 ?I need there listed some Labels and Textboxes.
Hello primts,
I have created the attached sample where I am attempting to model your situation so I can recommend the right approach. Please review the sample and modify it so that it demonstrates the issues you are trying to overcome.
Note that I am using the setting AutoArrangeCells="Never"on my FieldLayoutSettings object. This allows me to assign Row and Column values to my fields and headers to align them as I need. I am not sure if you are doing the same, but I wanted to highlight that.
Thanks,