Showing posts with label Binding. Show all posts
Showing posts with label Binding. Show all posts

12/14/10

Debugging XAML Binding

Good tip of the day:

To debug XAML Binding you can add reference to Diagnostics from WindowsBase dll to the XAML file, 
then when binding to some property add PresentationTraceSources.TraceLevel. When you run it check out 
the output window.


<TextBlock Text="{Binding someProperty, diagnostics:PresentationTraceSources.TraceLevel=High}"/>



9/16/10

Binding multiple properties to one XAML element using WPF MultiBinding

 <ListView.View>
   <GridView>
     <GridViewColumn Header="Address">
       <GridViewColumn.CellTemplate>
         <DataTemplate>
           <TextBlock>
             <TextBlock.Text>
               <MultiBinding StringFormat="{}{0}, {1}">
                 <Binding Path="Address.City"/>
                 <Binding Path="Address.State"/>
               </MultiBinding>
             </TextBlock.Text>
           </TextBlock>
         </DataTemplate>
       </GridViewColumn.CellTemplate>
     </GridViewColumn>
     ...
     ...
     ...