Archive

Archive for the ‘WPF’ Category

There was an error deserializing the object of type WebService ResponseBody. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 49035.’. Please see InnerException for more details.

April 20, 2013 1 comment

You can resolve this error by adding these lines at client app.config or web.config

<readerQuotas maxDepth=”32″ maxStringContentLength=”83886088″
maxArrayLength=”163848″ maxBytesPerRead=”40969″
maxNameTableCharCount=”163849″ />

so the full setting as follows

<bindings>

<basicHttpBinding>

<binding name=”PATWebServiceSoap” >

<readerQuotas maxDepth=”32″ maxStringContentLength=”83886088″             maxArrayLength=”163848″ maxBytesPerRead=”40969″             maxNameTableCharCount=”163849″ />

</binding>

</basicHttpBinding>

</bindings>

Happy coding:)

Advertisements
Categories: WPF

Set Scroll to Top DataGrid or ListView in WPF

October 31, 2012 Leave a comment

You can set the scroll of DataGrid or ListView to top programmatically. Here is the code

  ScrollViewer scrollViewer = GetScrollViewer(gridViewName) as ScrollViewer;
scrollViewer.ScrollToHome();

public static DependencyObject GetScrollViewer(DependencyObject o)
{
if (o is ScrollViewer)
{ return o; }

for (int i = 0; i < VisualTreeHelper.GetChildrenCount(o); i++)
{
var child = VisualTreeHelper.GetChild(o, i);

var result = GetScrollViewer(child);
if (result == null)
{
continue;
}
else
{
return result;
}
}

return null;
}

Happy coding

Categories: WPF

DatePicker in WPF .NET 3.5

October 11, 2012 Leave a comment

There is no datepicker control in WPF  .NET 3.5 by default.

We can get this by using WPF Toolkit.

You can download WPF toolkit that contains datepicker from http://wpf.codeplex.com/releases/view/22567

Make a new tab in toolbox

Right Click the tab and select Choose Items

Go WPF Components tab and Click Browse

Go to Tool Kit Installed directory probably C:\Program Files\WPF Toolkit\v3.5.40128.1\

Choose the WPFToolkit.dll and click open.

Click OK.

Now you can see the new tab is populates with some new controls

Now you can drag and drop the datepicker in your page

 

Happy coding 🙂

Categories: WPF Tags:

Set an Icon for WPF Application

October 4, 2012 Leave a comment

You can set an Icon for your WPF application. First you have to create 24 x 24 .ico file and put inside the application root directory.

Best software to create and manipulate icon file is IconXP. you can download from here http://www.aha-soft.com/iconxp/ try it free(1 month).

To set an icon for WPF window, see the xaml shown below.

<Window x:Class=”MyApp.MainWindow”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
Title=”MainWindow” Height=”300″ Width=”350″ Icon=”icon.ico”>

..

</Window>

 

Categories: WPF Tags:

Accordion Control in WPF

October 3, 2012 Leave a comment

Basically there is no Accordion control in WPF. You have to use a 3rd party tool or you have to make it by yourself using StackPanel and Expander controls. I found a nice Accordion Demo here

http://files.cnblogs.com/RMay/AccordianDemo.rar

thank you Liang.Rui for this effort.

His article http://www.cnblogs.com/RMay/archive/2008/08/22/1273927.html (in chinese)

🙂

 

Categories: WPF Tags: