Click here to Skip to main content
15,911,711 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Create Image Programtically Pin
Abhinav S29-Apr-10 18:27
Abhinav S29-Apr-10 18:27 
GeneralRe: Create Image Programtically Pin
#realJSOP29-Apr-10 23:48
professional#realJSOP29-Apr-10 23:48 
QuestionRe: Create Image Programtically Pin
Michel Godfroid29-Apr-10 23:34
Michel Godfroid29-Apr-10 23:34 
AnswerRe: Create Image Programtically Pin
#realJSOP29-Apr-10 23:52
professional#realJSOP29-Apr-10 23:52 
AnswerRe: Create Image Programtically Pin
Tim Yen1-May-10 3:08
Tim Yen1-May-10 3:08 
GeneralRe: Create Image Programtically Pin
#realJSOP3-May-10 2:56
professional#realJSOP3-May-10 2:56 
QuestionDisplay an Exception in Treeview with innerexception being child Pin
Troyzajac29-Apr-10 5:19
Troyzajac29-Apr-10 5:19 
AnswerRe: Display an Exception in Treeview with innerexception being child Pin
rhuiden30-Apr-10 4:10
rhuiden30-Apr-10 4:10 
I think the real problem with this method is that InnerException is not a collection. You may be able to use a converter to convert InnerException to an array of exception objects. However, there is a much easier method.

Here is a simple sample Window that does something similar to what I think you want.

XAML
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <DataTemplate DataType="{x:Type s:Exception}">
            <Expander Margin="20,0,0,0"  Header="{Binding Message}" Content="{Binding InnerException}"/>
        </DataTemplate>
    </Window.Resources>
    <DockPanel>
        <Button DockPanel.Dock="Bottom" Click="Button_Click">Error!</Button>
        <ContentPresenter Name="Bob" />
    </DockPanel>
</Window>


CODE (Pardon the VB)
Class MainWindow
	Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
		Try
			a()
		Catch ex As Exception
			Me.Bob.Content = ex
		End Try
	End Sub

	Private Sub a()
		Try
			b()
		Catch ex As Exception
			Throw New ArgumentException("WOW!", ex)
		End Try
	End Sub

	Private Sub b()
		Try
			c()
		Catch ex As Exception
			Throw New InvalidCastException("no good", ex)
		End Try
	End Sub

	Private Sub c()
		Throw New InvalidOperationException("Bad magic")
	End Sub
End Class


I use WPF's awesomeness with DataTemplates. Any exception object it displays will look like an Expander.
QuestionBinding Selected Value to Combobox Pin
LePoulpe30329-Apr-10 4:08
LePoulpe30329-Apr-10 4:08 
AnswerRe: Binding Selected Value to Combobox Pin
Parwej Ahamad29-Apr-10 6:14
professionalParwej Ahamad29-Apr-10 6:14 
GeneralRe: Binding Selected Value to Combobox Pin
LePoulpe3032-May-10 23:28
LePoulpe3032-May-10 23:28 
QuestionDatabase Populated Menu Pin
Tripathi Swati29-Apr-10 0:53
Tripathi Swati29-Apr-10 0:53 
AnswerRe: Database Populated Menu Pin
Abhinav S29-Apr-10 18:29
Abhinav S29-Apr-10 18:29 
GeneralRe: Database Populated Menu Pin
Tripathi Swati29-Apr-10 18:42
Tripathi Swati29-Apr-10 18:42 
GeneralRe: Database Populated Menu Pin
Abhinav S29-Apr-10 19:18
Abhinav S29-Apr-10 19:18 
Questionhow can I apply textblock properties to Path??? Pin
urooj_mahmood28-Apr-10 21:50
urooj_mahmood28-Apr-10 21:50 
AnswerRe: how can I apply textblock properties to Path??? Pin
Abhinav S29-Apr-10 18:34
Abhinav S29-Apr-10 18:34 
GeneralRe: how can I apply textblock properties to Path??? Pin
urooj_mahmood29-Apr-10 20:24
urooj_mahmood29-Apr-10 20:24 
AnswerRe: how can I apply textblock properties to Path??? Pin
Abhinav S30-Apr-10 18:45
Abhinav S30-Apr-10 18:45 
GeneralRe: how can I apply textblock properties to Path??? Pin
urooj_mahmood2-May-10 20:16
urooj_mahmood2-May-10 20:16 
AnswerRe: how can I apply textblock properties to Path??? Pin
Abhinav S2-May-10 21:04
Abhinav S2-May-10 21:04 
GeneralRe: how can I apply textblock properties to Path??? Pin
urooj_mahmood2-May-10 22:08
urooj_mahmood2-May-10 22:08 
QuestionWPF : Collapsing the visibility of a grid [modified] Pin
Prasoon Chaudhary28-Apr-10 20:43
Prasoon Chaudhary28-Apr-10 20:43 
AnswerRe: WPF : Collapsing the visibility of a grid Pin
Arun Jacob28-Apr-10 21:00
Arun Jacob28-Apr-10 21:00 
GeneralRe: WPF : Collapsing the visibility of a grid Pin
Prasoon Chaudhary28-Apr-10 21:22
Prasoon Chaudhary28-Apr-10 21:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.