|
|
|
|
.NET Training, Consulting, Coaching & Development
|
|
Scott Hanselman is looking for WPF TextBlock with stroke text.
With WPF this is a really easy and flexible task to do. What needs to be done is to set the Decorations of the TextBlock:
<TextBlock FontSize="18">
<TextBlock.TextDecorations>
<TextDecoration Location="Strikethrough">
<TextDecoration.Pen>
<Pen Brush="Red" />
</TextDecoration.Pen>
</TextDecoration>
</TextBlock.TextDecorations>
Sample
</TextBlock>
Christian
|
|
|
I've stored an invoice from the Internet as XPS for later printing. Now printing with the XPSViewer.exe fails with an exception because it demands permission for UnmanagedCode.
Instead trying to find a fix for the application I've written a small program to print XPS:
PrintDialog dlg = new PrintDialog();
if (dlg.ShowDialog() == true)
{
XpsDocument doc = new XpsDocument(fileName, System.IO.FileAccess.Read);
dlg.PrintDocument(doc.GetFixedDocumentSequence().DocumentPaginator, "Test");
}
It's really easy to work with XPS. XpsDocument is part of .NET 3.5 in the assembly ReachFramework, namespace System.Windows.Xps.Packaging.
Christian
|
|
|
Am 5. Mai 2008 gibt es einen Tag mit Visual Studio 2008 und SQL Server 2008 in Zürich!
Next Generation of Data-Centric Applications with Visual Studio 2008 and SQL Server 2008
Durch den Tag führen Meinrad Weiss für SQL Server 2008 und ich für Visual Studio 2008.
Die Themen:
- LINQ und C# 3.0
- LINQ to SQL
- LINQ to XML
- ADO.NET Entity Framewok
und natürlich auch SQL Server 2008:
- New SQL Statements (e.g. Merge)
- New Data Types (Date, Large UDTs, Spatial, Filestream, HierarchyId …)
- Resource Management
- Change Data Capture
- Data Profiling
- Star Join optimization
- Data Compression
- Transparent Encryption
See you there!
Christian
|
|
|
Professional C# 2008 is here! It contains 1800 pages although some chapters like .NET Remoting have been removed. The sixth edition was changed to include C# 3.0 and .NET 3.5! All the chapters of the book were changed to the new C# 3.0 syntax. Lambda expressions can be useful in many different cases. A big focus of the book is into .NET 3.0 and 3.5. While the previous edition had one chapter about WPF, this edition gives you a lot more information. The same is true for WCF and WF. Beside having changes in all chapters to the new C# 3.0 syntax, LINQ has some dedicated chapters: 11 - Language Integrated Query; 27 - LINQ to SQL; 29 - LINQ to XML. You can also find a preview on the ADO.NET Entity Framework in appendix A. For ASP.NET 3.5, ASP.NET AJAX can be found in chapter 39. And much more! All you need for C# 3.0 and core information about the complete .NET Framework 3.5.
|
|
|
Bei der .NET User Group Austria geht's am Donnerstag, 27. März um SQL Server 2008:
usergroups.at
- New Data Types (DATE, TIME, FILESTREAM, Spatial, HierarchyID
- Table Valued Constructors
- Table Valued Parameters
- Data Compression
- MERGE T-SQL
- Change Data Capture
- Delcarative Management Framework
Christian
|
|
|
|
Writing WPF applications I prefer using the XAML editor instead of the designer. With the help of Visual Studio 2008 intellisense this can be done really quick!
Now intellisense for XAML was broken - the solution posted by Brett Kilty (a missing path to the TextMgrP COM Library):
Intellisense broken in all WPF applications
Christian
|
|
|
|
It took some time after the first alpha (which was available for Beta 1 of Visual Studio 2008) - now a new version of LINQ to XSD is here:
LINQ to XSD Alpha 0.2
Christian
|
|
|
Wichtige .NET Developer Events in Wien:
Christian
|
|
|
My book Enterprise Services with the .NET Framework is now available translated to Japanese!
You can get it here:
Amazon Japan
Christian
|
|
|
C# is a changing language. C# 1.0 was all about core component-support. With C# 2.0 generics have been added. C# 3.0 added LINQ and extensions that are very useful with LINQ such as extension methods, object initializer, collection initializer, anonymous types....
What about the next version of C#?
One important part is using of types defined by dynamic languages such as IronRuby or IronPython.
The C# team considers the keyword dynamic that's shown in the blog of Charlie Calvert: Future Focus 1: Dynamic Lookup
Christian
|
|
|
Dan Wahlin posts about LINQ and Lambdas and Sprocs... Oh My!
With his post he defines a complex LINQ query to join several tables from the Northwind database:
public IEnumerable
GetOrderDetails(int orderID)
{
NorthwindDataContext db = this.DataContext;
IEnumerable orderDetails =
from o in db.Orders
where o.OrderID == orderID
join s in db.Shippers on o.ShipVia equals s.ShipperID
join od in db.OrderDetails on o.OrderID equals od.OrderID
join p in db.Products on od.ProductID equals p.ProductID
join supplier in db.Suppliers on p.SupplierID equals supplier.SupplierID
let total = od.Quantity * od.UnitPrice
select new OrderDescription
{
Product = p.ProductName,
Quantity = od.Quantity,
ShipperName = s.CompanyName,
Total = total,
UnitPrice = od.UnitPrice,
SupplierName = supplier.CompanyName
};
return orderDetails;
}
Instead of using joins with the LINQ query expression it is also possible to use compound from and access shipper and supplier (with a * to 1 relation) directly:
public IEnumerable
GetOrderDetails(int orderID)
{
NorthwindDataContext db = this.DataContext;
IEnumerable orderDetails =
from o in db.Orders
where o.OrderID == orderID
from od in o.OrderDetails
let total = od.Quantity * od.UnitPrice
select new OrderDescription
{
Product = od.Product.ProductName,
Quantity = od.Quantity,
ShipperName = o.Shipper.CompanyName,
Total = total,
UnitPrice = od.UnitPrice,
SupplierName = od.Product.Supplier.CompanyName
};
return orderDetails;
}
I think the LINQ query with compound from is the simpler one.
Christian
|
|
|
If the main Window of an WPF application should automatically be sized to its content, setting the Width and Height properties to Auto does not help. With this setting the Window gets a default height and width. To resize the main window to its content, the property SizeToContent can be set. If the Height and Width properties are set as well to Auto, the Window gets resized dynamically as the size of the content changes.
<Window x:Class="SizingTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Width="Auto" Height="Auto" SizeToContent="WidthAndHeight" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Margin="5" Grid.Column="0" Grid.Row="0">Value 1:</Label>
<Label Margin="5" Grid.Column="0" Grid.Row="1">Value 2:</Label>
<Label Margin="5" Grid.Column="0" Grid.Row="2">Value 3:</Label>
<TextBox Margin="5" Grid.Column="1" Grid.Row="0" MinWidth="100" />
<TextBox Margin="5" Grid.Column="1" Grid.Row="1" MinWidth="100" />
<TextBox Margin="5" Grid.Column="1" Grid.Row="2" MinWidth="100" />
</Grid>
</Window>
Christian
|
|
|
From time to time I'm asked if there's a SWF to XAML conversion tool.
From Tim Sneath's blog: The Converted.
It convert's Flash animations to the XAML format.
Christian
|
© 2002 - 2006 by thinktecture, Ingo Rammer and Christian Weyer. All rights reserved.

|
|