C# .NET - WPF,Datagrid, fixed row number,
Asked By Raman
15-Oct-10 02:28 AM
Hi,
I am using a datagrid in which I need to allow user only to add 256 rows. How can I do it?
Thanks,
Raman
Michael Detras replied to Raman
Hi, you can try adding a trigger:
<Trigger Property="Items.Count" Value="256">
<Setter Property = "CanUserAddRows" Value="False"/>
</Trigger>
This is just a guess so I'm not sure if this will work. Hope this helps.
Raman replied to Michael Detras
thanks for the reply michael.
But WPF datagrid doesnot have property "Items".
Any other idea? :)
Michael Detras replied to Raman
I checked it again and DataGrid does have an Items property. It inherited it from ItemsControl. Are you using WPF or Silverlight? As far as I can remember, the Silverlight version of the DataGrid does not have an Items property.
Raman replied to Michael Detras
I tried adding the xaml code you provided as content of datagrid but it throws compile time error which says "Cannot find the type 'Items'". Am I doing something wrong?
Michael Detras replied to Raman
Not sure what is wrong. Could you post some code?
Raman replied to Michael Detras
<DataGrid Name="dgColorConfiguration"
AutoGenerateColumns="False"
CanUserResizeRows="False"
Grid.Row="1" RowHeaderWidth="20"
CanUserDeleteRows="False"
ItemsSource="{Binding CopiedColorPalette}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ColumnWidth="*"
IsSynchronizedWithCurrentItem="True">
<Trigger Property="Items.Count" Value="256">
<Setter Property = "CanUserAddRows" Value="False"/>
</Trigger>
</DataGrid>
<
Michael Detras replied to Raman
Use it like this:
<DataGrid>
<DataGrid.Style>
<Style TargetType="DataGrid">
<Style.Triggers>
<Trigger Property="Items.Count" Value="256">
<Setter Property = "CanUserAddRows" Value="False"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Style>
</DataGrid>
Hope this helps.

C# with XP look .NET Framework Hi guys. I am newbie in C#. I have a project written in MS VisualStudio 2008, C#. So when I execute the project (Windows Forms Application) on the same machine when MSVS2008 look on any machine, regardless if MSVS2008 installed or not, and how. Thanks in advance. C# Discussions Environment.OSVersion.Version.Major (1) Environment.OSVersion.Version.Minor (1) OSFeature.Feature.IsPresent (1) Application.EnableVisualStyles (1) OSFeature.Themes (1) Outlook (1) SameApplicationOnAnotherMachine (1) WPF (1) he on investigate on EnableVisualStyles() . . . However if you want it to be look like of the UI is now all about using the classes in the Windows Presentation Foundation (WPF). but, can XP use WPF? Windows UI MSVS2008 Yes, of course. Where could I get these Windows Presentation Foundation classes? They're part of .NET 3.0. - - Web site: http: / / www.pobox.com / ~skeet Blog: http: / / www
C# vs. C++ .NET Framework I don't want to start a war but why would I choose I have some say on which but perhaps not the final decision. I have used C and C++ a little bit years ago. I have no experience in C#. I don't expect it to be that difficult but I hate remembering the idiosyncrasies of too many languages so I'd like to pick one C# or C++ and make the right choice. C# Discussions IEh1aD8gIE91ciBlbnRpcmUgdGVsZWNvbW11 (1) MLadnZvSnNEvHMPVnZ2dnUVZ (1) CmFtbWluZywgSSB1c2UgQyMuDQo (1) IA0KPiBGaXJzdCBh (1) SQL Server 2005 (1) Windows Vista
Why C# .NET Framework Why should I use C# programming rather than C++? Does C# have advantages over C++? C# Discussions IEMjIGhhdmUgYWR2YW50YWdlcyBvdmVyIEMrKz8NCj4gDQo (1) IHdyb3RlIGluIG1lc3NhZ2UgbmV3czo0OThmNTEwNiQwJDI (1) IHdyb3RlIGluIG1lc3NhZ2UgbmV3czo0OThmNTEwNiQw (1) PiAiQnJ1Y2UgRiIgPHpub3RpZnlAaG90bWFpbC5jb20 (1) IG5ld3M6RDVCQTg0ODktQjg5OC00 (1) IA0KPiAiQnJ1Y2UgRiIgPHpub3Rp (1) IHdyb3RlIGluIG1lc3NhZ2UgbmV3czpE (1) IHdyb3RlIGluIG1lc3NhZ2UgDQo (1) Yes. But C++ also has advantages over C#. Personally, I like the features in C# more than I like the cool things in
Semi-newbie question on Visual C++ vs. Visual C# C++ / VB Short version: I will be creating stand-alone applications for Windows. Which environment will make it quicker and easier for me to create the necessary GUI's - - Visual C++ or Visual C#? Longer version: I took a bunch of programming classes some years back, including two semesters of C++, but I've been away from it for a while. One thing I found with C++ was that trying to create even a basic GUI using Visual Studio 6 with MFC front-end for data input, setting parameters, results display, etc. I've downloaded both Visual C++ Express and Visual C# Express, but haven't explored them yet, and I'm trying
P, #<@(#<Z, 3@Z M, S0@($)U:6QD('1Y<&4Z(%-(25 @54Y)0T]$12 S+C Q+C0P, # N, C0S-2 @ M0V%L;&EN9R!P<F]C97-S.B!#.EQ724Y$3U = 37 297-E M = '1I;F<@8V%C:&5D('!O;&EC>2!V86QU97, -"DU322 H8RD@*#DP.C!#*2!; M, #<Z, 3@Z, S0Z-3, U73H@36%C:&EN92!P;VQI8WD@ = F%L = 64@)T1E8G5G)R!I M<R P#0I-4TD@*&, I("@Y, #HP0RD@6S W.C$X.C, T.C4S-5TZ("HJ*BHJ*BH@ M4G5N16YG:6YE.@T*(" @(" @(" @(" J*BHJ*BHJ(%!R;V1U8W0Z('LR 9&EA;&]G(&YO = "!E;F%B;&5D M#0I-4TD@*&, I("@Y, #HP0RD@6S W.C$X.C, T.C@T.%TZ($]R:6 = I;F%L('!A M8VMA9V4@ / 3T^($, Z7% = )3D1 / 5U-<26YS = &%L;&5R7#, P-3DW, C, N;7-I#0I- M4TD@*&, I("@Y, #HP0RD@6S W.C$X.C, T.C