ContentControl3D with xamDataGrid

Mar 26, 2009 at 4:52 AM

Hats off to you!!

 

First of all congratulation and thanks for your great work. I have been reading your articles and am very impress with the quality of the material.

 

I have been playing with WPF lately and finally have been given an assignment. I am supposed to use the xamDataGrid grid. this is going to be my first assignment.

 

Firs of all can I use your control in my project?

 

If yes,

 

Do you think it is possible to use ContentControl3D in custom template for CellValuePresenter?

 

My idea is to use front side of the cell to display the read-only information and when you click on it then back content will provide UI to enter/edit information in each cell.

 

It would be really great if you could provide some pointer or links to sample related to that.

 

I am sorry if I am asking for too much.

 

VS

Coordinator
Mar 26, 2009 at 5:29 PM
Hi Vivek,

I created a sample that shows how to use ContentControl3D in XamDataGrid.  You can download it from the Releases page of this project.

http://thriple.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24393

Josh
Mar 26, 2009 at 9:32 PM
Thanks Josh,

I really appreciate your help.

Thanks,
VS
Mar 29, 2009 at 11:09 PM

 

 

Hi Josh,

 

I have one more question related to the binding to the ContentControl3D.RotateCommand command. What is the best way to disable the flip of control based on some property in the ViewModel?

 

For example the back side/ editable side of the CC3D is only available for certain type of users. One way I can think is to trigger the command off the some UIElement click and use DataTrigger to control the visibility of that UIcontrol by binding to the viewModel.

 

Is there any better way? Or is there any property that is available on CC3D to achieve this?

 

VS

Mar 29, 2009 at 11:30 PM
I think I found my answer. The “CanRotate” property of ContentControl3D should do that job. Is that correct?
Coordinator
Mar 31, 2009 at 2:39 PM
Yes, the CanRotate property exists to serve that purpose.

Josh
Apr 16, 2009 at 6:20 PM

Hi Josh,

 

I need your advice on something. This is related to my last question where I am using CC3D in cell of a xamDataGrid grid. The backside of the cell is an editable form. I needed to provide a ‘Save’ button there. What I did is added a Save button and a flip button. Now I am required to merge these two buttons. So as soon as user clicks on ’Save’ button then it should save the content and also perform the flip. Plus if there is any error in saving then it shouldn’t perform the flip.

 

What is the best way to do that? Could you please provide some pointers?

 

VS  

Coordinator
Apr 16, 2009 at 10:06 PM
Don't have the Save/Flip button execute the RotateCommand.  Have it execute some other command, and when the save operation completes, if it was successful, then you can tell the CC3D to rotate.
Apr 16, 2009 at 11:15 PM
Thanks Josh,

So basically follow the RotationDestinationSample. Keep a refenerec to taget cc3d and do something like below after the successful save

if

(ContentControl3D.RotateCommand.CanExecute(destination, this.CommandTarget))

 

 

        ContentControl3D.RotateCommand.Execute(destination, this.CommandTarget);

 


or is there another way to tell cc3d to rotate?

Thanks,
VS


Oct 21, 2009 at 4:28 PM

Hey Josh, any chance we can get your DataGrid example using the WPF DataGrid in addition to your infragistics example?

 

Coordinator
Oct 21, 2009 at 4:40 PM

sisnaz,

Good suggestion.  If I can find the time and motivation and nothing else interests me more at the moment, then sure.  :-)

Thanks,

Josh

Oct 21, 2009 at 4:51 PM

LOL - Cheers mate! :-)

 

Oct 22, 2009 at 5:32 PM

Josh, I reworked your infragistics data grid example to use the WPF DataGrid. While I'm sure you would do it differently, I thought I would at least share the code.

The only change needed is in the Window1.xaml file replace the Infragistics DataGrid with the WPF DataGrid

<my:DataGrid Name="dataGrid1" ItemsSource="{Binding}" Margin="10"
                  AutoGenerateColumns="False"
                  Background="#80909090">

			<my:DataGrid.Columns>
				<my:DataGridTemplateColumn Header="Profile" MinWidth="250">
					
					<my:DataGridTemplateColumn.CellEditingTemplate>
						<DataTemplate>
							<StackPanel>
								<local:PersonProfileControl
                                    Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:DataGridRow}}}" />
							</StackPanel>
							
						</DataTemplate>
					</my:DataGridTemplateColumn.CellEditingTemplate>
					<my:DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding FullName}" />
						</DataTemplate>
					</my:DataGridTemplateColumn.CellTemplate>

				</my:DataGridTemplateColumn>
				
			</my:DataGrid.Columns>
		</my:DataGrid>

So one more question if you don't mind: How would you go about rotating the entire grid (or row) to the back content form instead of inside the cell?