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
565
xamdatagrid FieldChooser not showing any fields
posted

I'm trying to get the field chooser to work and am not having any luck.  I am sure I am missing incredibly basic, but I can't figure it out.

Note that the field chooser attached to the data presenter, or popped up by using the field chooser button both fail to display and fields.

The xamdatagrid does however show columns for the persepctive fields.

Here is the xaml:

<DockPanel LastChildFill="True">
<dataPresenter:FieldChooser x:Name="FieldChooser"
DataPresenter="{Binding ElementName=DataGrid}"
Width="180"
Margin="2,2,2,10"
DockPanel.Dock="Left"
FieldDisplayOrder="SameAsDataPresenter"
/>
<dataPresenter:XamDataGrid x:Name="DataGrid"
DataSource="{Binding DataItems}"
GroupByAreaLocation="None" CellChanged="DataGrid_CellChanged"

>
<dataPresenter:XamDataGrid.FieldLayoutSettings>
<dataPresenter:FieldLayoutSettings AllowAddNew="False"
AllowDelete="True"
AutoFitMode="Always"
AutoGenerateFields="False"
HeaderPrefixAreaDisplayMode="FieldChooserButton"
AllowFieldMoving="Yes"
ResizingMode="Immediate"
SelectionTypeCell="None"
SelectionTypeField="None"
SelectionTypeRecord="Single"
/>
</dataPresenter:XamDataGrid.FieldLayoutSettings>
<dataPresenter:XamDataGrid.FieldLayouts>
<dataPresenter:FieldLayout IsDefault="true">
<dataPresenter:FieldLayout.Fields>
<dataPresenter:CheckBoxField Name="IsVisible"
Label="V"
Width="Auto"
HorizontalContentAlignment="Center"
/>

<dataPresenter:TemplateField Name="Stroke"
IsReadOnly="True"
Width="70"
Label="Color"
HorizontalContentAlignment="Center"
>
<dataPresenter:TemplateField.DisplayTemplate>
<DataTemplate>
<Rectangle Width="50"
Height="20"
Fill="{Binding Path=(igEditors:TemplateEditor.Editor).Value,
Converter={StaticResource ColorToBrushConverter},
RelativeSource={RelativeSource Self}}"/>
</DataTemplate>
</dataPresenter:TemplateField.DisplayTemplate>
<dataPresenter:TemplateField.EditTemplate>
<DataTemplate>
<ig:XamColorPicker Width="50"
Height="20"
SelectedColor="{Binding Path=(igEditors:TemplateEditor.Editor).Value,
RelativeSource={RelativeSource Self},
UpdateSourceTrigger=PropertyChanged,
Mode=TwoWay}" />
</DataTemplate>
</dataPresenter:TemplateField.EditTemplate>
</dataPresenter:TemplateField>

<dataPresenter:TextField Name="Path"
Label="File"
IsReadOnly="True"
AllowEdit="False"
Visibility="Collapsed"
Width="*"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Name="FileName"
Label="File"
IsReadOnly="True"
AllowEdit="False"
Width="*"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Speed"
IsReadOnly="True"
AllowEdit="False"
Width="Auto"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=Speed}"
TextAlignment="Right"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Frequency"
IsReadOnly="True"
AllowEdit="False"
Width="Auto"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=Frequency}"
TextAlignment="Right"
Visibility="Collapsed"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Stroke"
IsReadOnly="True"
AllowEdit="False"
Width="Auto"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=Stroke}"
TextAlignment="Right"
Visibility="Collapsed"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Amplitude"
IsReadOnly="True"
AllowEdit="False"
Width="75"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=Amplitude}"
TextAlignment="Right"
Visibility="Collapsed"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Rod Diameter"
IsReadOnly="True"
AllowEdit="False"
Width="Auto"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=RodDiameter}"
TextAlignment="Right"
Visibility="Collapsed"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Gas Test"
IsReadOnly="True"
AllowEdit="False"
Width="75"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=GasTest}"
TextAlignment="Right"
Visibility="Collapsed"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>

<dataPresenter:TextField Label="Gas Pressure"
IsReadOnly="True"
AllowEdit="False"
Width="Auto"
AlternateBinding="{Binding Converter={StaticResource DataItemViewModelConstantConverter}, ConverterParameter=GasPressure}"
TextAlignment="Right"
Visibility="Collapsed"
>
<dataPresenter:TextField.CellBindings>
<dataPresenter:CellBinding Property="Foreground"
Target="CellValuePresenter"
Binding="{Binding Path=DataItem.Stroke, Converter={StaticResource ColorToBrushConverter}}"
/>
</dataPresenter:TextField.CellBindings>
</dataPresenter:TextField>
</dataPresenter:FieldLayout.Fields>
</dataPresenter:FieldLayout>
</dataPresenter:XamDataGrid.FieldLayouts>

<dataPresenter:XamDataGrid.FieldSettings>
<dataPresenter:FieldSettings AllowCellVirtualization="True"
AllowCrossFieldRecordFiltering="False"
AllowFixing="NearOrFar"
AllowGroupBy="True"
AllowRecordFiltering="False"
AllowHiding="Never"
AllowResize="False"
AllowSummaries="False"
AutoSizeOptions="All"
IsAutoEditModeEnabled="False"
LabelClickAction="SortByMultipleFields"
>
</dataPresenter:FieldSettings>

</dataPresenter:XamDataGrid.FieldSettings>
</dataPresenter:XamDataGrid>
</DockPanel>

Parents
  • 565
    Verified Answer
    Offline posted

    And I figured out the problem... apparently, the AllowHiding on the field settings causes the field chooser does not display any fields whatsoever.

    Stupid mistake on my part.

Reply Children
No Data