I never worked with Xam grid, I’d imagine it should be similar
to SL grid though. Check Rolodex project – company editor screen
and look for custom column. Hopefully, this is what you are looking for.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Fintanv
[mailto:cslanet@lhotka.net]
Sent: Tuesday, November 25, 2008 3:59 PM
To: Sergey Barskiy
Subject: [CSLA .NET] XamDataGrid and PropertyStatus
Has anyone managed to get the PropertyStatus control to work
with the XamDataGrid?
If so would you mind sharing your implementation?
TIA
Fintan
Sorry to hear that. I worked with infragistics grid for
about 3 years, and it seems like a decent product for WinForms, although
learning curve is pretty steep. I personally think that in WPF there is
much less reason to go with third party grids because you can do anything you
want with templates in WPF. I am surporises that their WPF grid does not
support template columns – seems like such a basic feature.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Fintanv
[mailto:cslanet@lhotka.net]
Sent: Tuesday, November 25, 2008 6:20 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: XamDataGrid and PropertyStatus
Ah if only that were true. I had things working with
the MS DataGrid, but needed the extra functionality found in the Infragistics
grid which is a wee bit more complex. Now why didn't they build in
support for the IDataErrorInfo interface. I had to hassle them for the
same functionality in their WinForms grid some years back. ">
I finally figured out a way to display the PropertyStatus control within a cell of the XamDataGrid by hi-jacking the XAML for the CellValuePresenter template. Here is a style that can be applied to a column to display the CSLA PropertyStatus control.
Enjoy.
-- Fintan
<Style x:Key="CustomCellValuePresenter" TargetType="igDP:CellValuePresenter"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igDP:CellValuePresenter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:igDP="http://infragistics.com/DataPresenter" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igWindows="http://infragistics.com/Windows"> <igWindows:CardPanel Width="{TemplateBinding FrameworkElement.Width}" Height="{TemplateBinding FrameworkElement.Height}"> <Border BorderThickness="{TemplateBinding Border.BorderThickness}" CornerRadius="{TemplateBinding igDP:CellValuePresenter.CornerRadius}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="MainBorder" /> <Rectangle Fill="{TemplateBinding igDP:CellValuePresenter.BackgroundActive}" Stroke="{TemplateBinding igDP:CellValuePresenter.BorderActiveBrush}" StrokeThickness="1" Name="Active" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="1" Visibility="Collapsed" SnapsToDevicePixels="True" /> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <csla:PropertyStatus Grid.Column="0" Source="{Binding Path=Record.DataItem, RelativeSource={RelativeSource Mode=TemplatedParent}}" Property="{Binding Path=Field.Name, RelativeSource={RelativeSource Mode=TemplatedParent}}" /> <ContentPresenter Grid.Column="1" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" Style="{TemplateBinding igDP:CellValuePresenter.ForegroundStyle}" Name="PART_EditorSite" Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" /> </Grid> </igWindows:CardPanel> <ControlTemplate.Triggers> <Trigger Property="igDP:DataItemPresenter.HighlightAsPrimary"> <Setter Property="Panel.Background" TargetName="MainBorder"> <Setter.Value> <Binding Path="BackgroundPrimary" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="Border.BorderBrush" TargetName="MainBorder"> <Setter.Value> <Binding Path="BorderPrimaryBrush" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"> <Setter.Value> <Binding Path="ForegroundPrimaryStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Trigger.Value> <s:Boolean>True</s:Boolean> </Trigger.Value> </Trigger> <Trigger Property="igDP:CellValuePresenter.IsFieldSelected"> <Setter Property="Panel.Background" TargetName="MainBorder"> <Setter.Value> <Binding Path="BackgroundFieldSelected" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="Border.BorderBrush" TargetName="MainBorder"> <Setter.Value> <Binding Path="BorderFieldSelectedBrush" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"> <Setter.Value> <Binding Path="ForegroundFieldSelectedStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Trigger.Value> <s:Boolean>True</s:Boolean> </Trigger.Value> </Trigger> <Trigger Property="igDP:CellValuePresenter.IsSelected"> <Setter Property="Panel.Background" TargetName="MainBorder"> <Setter.Value> <Binding Path="BackgroundSelected" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="Border.BorderBrush" TargetName="MainBorder"> <Setter.Value> <Binding Path="BorderSelectedBrush" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"> <Setter.Value> <Binding Path="ForegroundSelectedStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Trigger.Value> <s:Boolean>True</s:Boolean> </Trigger.Value> </Trigger> <Trigger Property="igDP:CellValuePresenter.IsActive"> <Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"> <Setter.Value> <Binding Path="ForegroundActiveStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="UIElement.Visibility" TargetName="Active"> <Setter.Value> <x:Static Member="Visibility.Visible" /> </Setter.Value> </Setter> <Trigger.Value> <s:Boolean>True</s:Boolean> </Trigger.Value> </Trigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="UIElement.IsMouseOver"> <Condition.Value> <s:Boolean>True</s:Boolean> </Condition.Value> </Condition> <Condition Property="igDP:CellValuePresenter.IsSelected"> <Condition.Value> <s:Boolean>False</s:Boolean> </Condition.Value> </Condition> <Condition Property="igDP:CellValuePresenter.IsFieldSelected"> <Condition.Value> <s:Boolean>False</s:Boolean> </Condition.Value> </Condition> </MultiTrigger.Conditions> <Setter Property="Panel.Background" TargetName="MainBorder"> <Setter.Value> <Binding Path="BackgroundHover" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="Border.BorderBrush" TargetName="MainBorder"> <Setter.Value> <Binding Path="BorderHoverBrush" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> <Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"> <Setter.Value> <Binding Path="ForegroundHoverStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /> </Setter.Value> </Setter> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
Copyright (c) Marimer LLC