Hi,
I've added a xamDataGrid to my wpf usercontrol, but nothing displays, even though I point it at a datasource.
I'd just like to get a designer's view so that I can arrange columns, hide / show row selector, etc.
Any ideas?
I don't know how you did it. However, you should be knowledgeable about the xamDataGrid controlbinding behavior. When you bind the XamDataGrid in the designer, whether you use Visual Studio or Blend,you will not get a FieldLayout(s) generated for you.It is still required that these are generated by the developer manually.This can be done by typing xaml or by adding them through the Properties Pane/Window in Visual Studio or Blend. Once you have created the FieldLayouts and Fields, then you can use the properties window for setting propertiesthat affect how the XamDataGrid and/or fields are displayed.
If you are bind the DataSource of the XamDataGrid to a Resource, then you may see fields displayed in the designer,but this still doesn’t generate the corresponding FieldLayout.
If you are binding to the DataContext, then the Fields won’t even be visible in the designer.
For setting properties in the designer, the only option is the built in Properties pane/window in Visual Studio or Blend. If you want to be able to edit(set) any definite property through the built in properties pane/window you can log a feature request at http://devcenter.infragistics.com/Protected/RequestFeature.aspx .
To illustrate the above mentioned(in bold) bindings I will create and attach a working sample application soon.
Best Regards,Yanko
Yes, I understand what I want isn't supported yet, and have logged a feature request.
However, I am puzzled now. I did bind my grid to resource data provider, but the grid still did NOT show any columns in the designer. The columns only displayed after I setup the field layouts.
Now, the DataProvider is a 3rd party one; a CslaDataProvider (http://www.lhotka.net/cslanet/). I've already been told once that Infragistics won't "support" use of their controls with other 3rd party code.. but I hope you will change your mind on Csla. It has a fairly large following, and a common forum question is what 3rd party controls to use. Because of this attitude, many people are recommending NOT to use Infragistics. So it would be nice if more of an effort was made to work with Csla; the source code is available, so it shouldn't be difficult to either fix Infragistics controls if they aren't working, or contribute changes back to csla so they work properly (if in fact they don't).
Andy
We are using CSLA in our latest system. First time using it. I use the "GetList" method of the BusinessListBase business object and then set the data source of the grid to the results of the Getlist() method call.
this.WorkUnitLaborGrid.DataSource = myWorkUnits;
We also use the CSLA Data Provider to populate our xamComboEditor with Items:
In the XAML User Control Resources section:
<csla:CslaDataProvider x:Key="MarketSegmentList"
ObjectType="{x:Type BstList:MarketSegmentList}"
FactoryMethod="GetList"
IsAsynchronous="False" />
In the xamDataGrid Field Layout definition:
<igDP:Field Name="MarketSegment" Label="Mkt Segment" >
<igDP:Field.Settings>
<igDP:FieldSettings LabelMinHeight="29" CellValuePresenterStyle="{StaticResource WorkUnitDetCellStyle}"
LabelClickAction="Nothing" >
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource MarketSegmentList}}" />
<Setter Property="ToolTip" Value="What is the Market Segement for this Task?" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Height" Value="22" />
<Setter Property="DisplayMemberPath" Value="Value" />
<Setter Property="ValuePath" Value="Key" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
Hope this helps you
Yes, that does help more.
So is the other poster accurate in that settnig a DataSource to a StaticResource DataProvider should cause the columns to display in the designer, even if it doesn't generate the FieldSettings xaml?
I'm glad to hear Infragistics is looking at working with Csla. I appreciate it, and I'm sure other Csla'ers will as well.
I do not work for Infragistics and I am not sure if Infragistics is working with CSLA. I think it is up to us programmers to figure out methods to make CSLA and Infragistics work together. Plus Rocky is on top of things and the CSLADataProvider was provided to fill this gap and I bet he will continue to provide these upgrades to CSLA.
I am used to using the UltraWinGrid and setting up my field layouts in code to customize the grid layout. Creating the field layouts in XAML for the xamDataGrid is not a problem for me. Also I only want the user to see specific fields so a custom layout allows me complete control.
You have to have a field layout whether you write the XAML or use the "AutoGenerateFields" property to let the grid generate the layout. Even with the layout specified I have not seen the grid render in the Visual Studio designer, only at run time. I would think Expression Blend would be the place to perform your styling of the grid. I am not an EB user but our graphics person is using it to help us with WPF styling including the Infragistics control. There is a property of the xamDataGrid - "BindToSampleData", I have not used it. Maybe if you set this property to true you would see the grid render in the VS designer? There is more chance you would see it rendered in Expression Blend with BindToSampleData = true.
I agree that styling the grid by creating a custom layout without being able to see the effects might be impossible. We are using one of the themes that come with the NetAdvantage and tweaking it to fit our need. Much easier than starting from scratch plus it shows you all the styling points possible. It is mind boggling all the stuff you can style.
Ahh, sorry I assumed you had worked for Infragistics. Oh well..
I did try settings the BindToSample data to true, and sure enough sample data appears in the VS designer. Unfortunately, the sample data has nothing to do with the .Net type to which the DataProvider is bound... it gives you some columns for describing various cars...
i'm still trying to wrap my head around wpf in general.. including the styling. at some point I'll have to finish reading my Wpf Unleased book.. and then re-read it.
Don't feel like the lone ranger when it comes to WPF. I have created some styles, control templates, done some binding but I still don't feel I know exactly what to do and if I do something, am I doing it the "WPF" way. By next year we will both feel like experts.
I do not have a lot of time for styling as my main goal is to make sure the application performs the necessary functions and stores the necessary data. Today I am overwhlemed by the amount of styling that can be found in the Theme files but I hope that once I get a chance to dig in I will learn and it will make more sense. WPF is so flexible and powerful that anything can be accomplished if you have enough time to play around and figure it out.