I have this WPF application. Whenever I open MainWindow.xaml, the xaml file opens very slowly or when I run the solution when MainWindow.xaml is open, the solution runs very slowly. How can I fix this? Here is my MainWindow.xaml :
<Window x:Class="CodeFirstMVVM.App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cm="clr-namespace:System.ComponentModel;assembly=System"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:CodeFirstMVVM.App.ViewModels"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
DataContext="{Binding Source={StaticResource Locator}, Path=OgrenciView}"
Title="MainWindow" Height="500" Width="900">
<Grid>
<Canvas>
<Button Content="Yeni" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Command="{Binding EkleCommand}"/>
<Button Content="Güncelle" HorizontalAlignment="Left" Margin="109,10,0,0" VerticalAlignment="Top" Width="75" Command="{Binding DuzenleCommand}"/>
<Button Content="Sil" HorizontalAlignment="Left" Margin="207,10,0,0" VerticalAlignment="Top" Width="75" Command="{Binding SilCommand}"/>
<Button Content="Kaydet" HorizontalAlignment="Left" Margin="777,15,0,0" VerticalAlignment="Top" Width="75" Command="{Binding KaydetCommand}"/>
<Label Content="AdSoyad" Canvas.Left="25" Canvas.Top="51"/>
<Label Content="OkulNo" Canvas.Left="25" Canvas.Top="82"/>
<Label Content="Sınıf" Canvas.Left="25" Canvas.Top="113" RenderTransformOrigin="0.053,-0.231"/>
<Label Content="Yaş" Canvas.Left="25" Canvas.Top="144" RenderTransformOrigin="-0.053,-0.077"/>
<TextBox Height="23" Canvas.Left="131" TextWrapping="Wrap" Canvas.Top="51" Width="283" Name="txtAdSoyad" Text="{Binding AdSoyadUI}"/>
<TextBox Height="23" Canvas.Left="131" TextWrapping="Wrap" Canvas.Top="86" Width="283" Name="txtOkulNo" Text="{Binding OkulNoUI}"/>
<TextBox Height="23" Canvas.Left="131" TextWrapping="Wrap" Canvas.Top="117" Width="283" Name="txtSinif" Text="{Binding SinifUI}"/>
<TextBox Height="23" Canvas.Left="131" TextWrapping="Wrap" Canvas.Top="148" Width="283" Name="txtYas" Text ="{Binding YasUI}"/>
<DataGrid x:Name="dg01" ItemsSource="{Binding Entities, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedEntity}" CanUserAddRows="False" Canvas.Left="25" Canvas.Top="201" AutoGenerateColumns="False" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding AdSoyad}" Header="AdSoyad" Width="200" />
<DataGridTextColumn Binding="{Binding OkulNo}" Header="OkulNo" Width="50" />
<DataGridTextColumn Binding="{Binding Sinif}" Header="Sınıf" Width="50" />
<DataGridTextColumn Binding="{Binding Yas}" Header="Yaş" Width="50" />
</DataGrid.Columns>
</DataGrid>
<DataGrid ItemsSource="{Binding SelectedEntity.Notlar}" Canvas.Left="629" Canvas.Top="201" AutoGenerateColumns="False" >
<!-- <DataGrid ItemsSource="{Binding SelectedEntity.Notlar}" Canvas.Left="622" Canvas.Top="201" AutoGenerateColumns="False" >-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding NotDeger}" Header="Notlar"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Canvas>
</Grid>
</Window>
Here is my App.xaml :
<Application x:Class="CodeFirstMVVM.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
StartupUri="MainWindow.xaml"
mc:Ignorable="d">
<Application.Resources>
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:CodeFirstMVVM.ViewModels" />
</Application.Resources>
</Application>
I have a GetEntities method, adding a IsInDesignMode check seems to solve my problem :
protected override ObservableCollection<Student> GetEntities()
{
if (IsInDesignMode)
{
return null;
}
else
{
_entities = new ObservableCollection<Student>(_context.Set<Student>());
return _entities;
}
}
Related
Hello friend i have created wpf theme in which i place buttons so my questions is when i click the particular button the complete application color should change below is my code behind and xaml.
<UserControl x:Class="Alyex.Exchange.UserControls.UCUserThemes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxd="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxga="http://schemas.devexpress.com/winfx/2008/xaml/gauges"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxthm="clr-namespace:DevExpress.Xpf.Utils.Themes;assembly=DevExpress.Xpf.Core.v14.2"
xmlns:common="clr-namespace:Alyex.Common;assembly=Alyex.Common"
xmlns:commonUIHelpers="clr-namespace:Alyex.CommonUI.UIHelpers;assembly=Alyex.CommonUI"
xmlns:commonResource="clr-namespace:Alyex.Common.Resources;assembly=Alyex.Common"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="900" ToolTip="WindowsTransparency">
<UserControl.Resources>
<common:DebugConverter x:Key="debugConverter"/>
<common:LanguagetoHorizontalContentAligmentConverter x:Key="ContentAlignmentConverter"/>
<common:AllowInsertToNewNodeVisibilityConverter x:Key="newNodeVisibilityConverter"/>
<common:BoolToStatusConverter x:Key="boolToStatusConverter"/>
<DataTemplate x:Key="toolbarCustomization">
<dxb:BarManagerActionContainer>
<!--Remove Export Button-->
<dxb:RemoveBarItemAndLinkAction ItemName="export" />
<!--Remove Email Sending Button-->
<dxb:RemoveBarItemAndLinkAction ItemName="email" />
<!--Remove Save Button-->
<dxb:RemoveBarItemAndLinkAction ItemName="save" />
</dxb:BarManagerActionContainer>
</DataTemplate>
<DataTemplate x:Key="PageHeader" >
<DockPanel>
<StackPanel Orientation="Vertical">
<dxe:ImageEdit x:Name="logo" HorizontalAlignment="Left"
Margin="0,0,0,1" BorderThickness="0"
VerticalAlignment="Top" IsPrintingMode="True"
HorizontalContentAlignment="Stretch"
CausesValidation="False"
Source="/Alyex.CommonUI;component/Images/Alx/ReportHeader.jpg"
Stretch="Fill"
Height="40"
Width="238"
/>
<dxe:TextEdit IsPrintingMode="True"
Text="{Binding Source={x:Static sys:DateTime.Now},Mode=OneWay, StringFormat='{}{0:dddd, dd-MMMM-yyyy hh:mm tt}'}"
dxp:ExportSettings.TargetType="Text"
Background="Transparent"
Margin="0,0,0,3"
></dxe:TextEdit>
</StackPanel>
<dxe:TextEdit Grid.Column="1" Grid.RowSpan="2"
EditValue="{Binding Content,Mode=OneWay}"
dxp:ExportSettings.TargetType="Text"
FontSize="25" FontWeight="ExtraBold"
Margin="10,0,0,1"
Background="Transparent"
HorizontalAlignment="Center"
MaxWidth="{Binding Path=UsablePageWidth, Mode=OneWay}"
/>
</DockPanel>
</DataTemplate>
<DataTemplate x:Key="PageFooter">
<dxe:TextEdit
HorizontalContentAlignment="Center"
Width="{Binding Path=UsablePageWidth, Mode=OneWay}"
dxp:ExportSettings.TargetType="PageNumber"
dxp:PageNumberExportSettings.Kind="NumberOfTotal"
dxp:PageNumberExportSettings.Format="Page {0} of {1}" />
</DataTemplate>
<DataTemplate x:Key="StatusIndicator">
<StackPanel Orientation="Horizontal">
<dxga:StateIndicatorControl x:Name="lampRecordStatusIndicator" StateIndex="{Binding Path=RowData.Row.IsActiveRecord}" Width="20" Height="20">
<dxga:StateIndicatorControl.Model>
<dxga:LampStateIndicatorModel />
</dxga:StateIndicatorControl.Model>
</dxga:StateIndicatorControl>
<TextBlock x:Name="txtBlkRecordStatus" VerticalAlignment="Center" Text="{Binding Path=RowData.Row.IsActiveRecord, Converter={StaticResource boolToStatusConverter}, Mode=OneWay}"></TextBlock>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid x:Name="grdContainer" Margin="3,3,3,3">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<dxb:BarManager Name="barManager" CreateStandardLayout="True">
<dxd:DockLayoutManager x:Name="dockLayotManager" AllowDocumentSelector="False" Background="Transparent">
<dxd:LayoutGroup x:Name="layotGrp">
<dxd:DocumentGroup x:Name="docmntGrpUserThemes" ClosePageButtonShowMode="InAllTabPageHeaders"
ShowDropDownButton="False" CaptionLocation="Bottom" AllowFloat="False" AllowDrag="False">
<dxd:DocumentPanel x:Name="docmntPnlUserThemes" Caption="UserThemes"
AllowClose="False" AllowFloat="False" ToolTip="UserThemes"
AllowDrag="False">
<DockPanel>
<dxe:ListBoxEdit Name="lstboxwindowsTransparancy" Margin="10" SelectedIndexChanged="lstboxWindowsTransparency_SelectedIndexChanged"
ItemsSource="{Binding Source={x:Static dx:Theme.Themes},Mode=OneWay}">
<dxe:ListBoxEdit.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Height="{Binding (FrameworkElement.ActualHeight), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}" Orientation="Vertical" />
</ItemsPanelTemplate>
</dxe:ListBoxEdit.ItemsPanel>
<dxe:ListBoxEdit.ItemTemplate>
<DataTemplate>
<Button Width="130" Height="100">
<Button.Content>
<StackPanel>
<Image Source="{Binding SmallGlyph}" Width="40"/>
<AccessText TextWrapping="Wrap" Text="{Binding}" HorizontalAlignment="Center"></AccessText>
</StackPanel>
</Button.Content>
</Button>
</DataTemplate>
</dxe:ListBoxEdit.ItemTemplate>
</dxe:ListBoxEdit>
</DockPanel>
</dxd:DocumentPanel>
</dxd:DocumentGroup>
</dxd:LayoutGroup>
</dxd:DockLayoutManager>
</dxb:BarManager>
</Grid>
and this is my code behind
public partial class UCUserThemes : UserControl
{
public UCUserThemes()
{
InitializeComponent();
}
private void lstboxWindowsTransparency_SelectedIndexChanged(object sender, RoutedEventArgs e)
{
DXSplashScreen.Show<WaitDialogSSView>();
DevExpress.Xpf.Core.ThemeManager.ApplicationThemeName = DevExpress.Xpf.Core.Theme.Default.ToString();
ImageSource img = new BitmapImage(((DevExpress.Xpf.Core.Theme)lstboxwindowsTransparancy.SelectedItem).SmallGlyph);
ThemeManager.ApplicationThemeName = Theme.Office2010BlackFullName;
DXSplashScreen.Close();
}
}
}
ThemeManager.ApplicationThemeName= "Your Theme";
I have no idea what's happening here. When I bind directly to a TextBox the value can be edited, but I want to bind in a ContentControl.
Why doesn't the ContentControl update the ViewModel?
<Window x:Class="WTFWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WTFWPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="MainWindow"
Width="525"
Height="350"
DataContext="{DynamicResource ViewModel}"
mc:Ignorable="d">
<Window.Resources>
<local:MainViewModel x:Key="ViewModel" />
<DataTemplate DataType="{x:Type sys:Int32}">
<TextBox Text="{Binding Path=., UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</Window.Resources>
<StackPanel>
<TextBlock Margin="5" Text="{Binding Number}" />
<TextBox Margin="5" Text="{Binding Number, UpdateSourceTrigger=PropertyChanged}" />
<ContentControl Margin="5" Content="{Binding Number}" />
</StackPanel>
</Window>
This seem to work fine, not sure why your version doesn't work though.
<Window.Resources>
<wpfApplication1:MainViewModel x:Key="ViewModel" />
<DataTemplate x:Key="NumberTemplate">
<TextBox Text="{Binding Path=Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</Window.Resources>
<StackPanel>
<TextBlock Margin="5" Text="{Binding Number}" />
<TextBox Margin="5" Text="{Binding Number, UpdateSourceTrigger=PropertyChanged}" />
<ContentControl Margin="5"
Content="{Binding}"
ContentTemplate="{StaticResource NumberTemplate}" />
</StackPanel>
Another way of making it work is to change the binding in the template:
<TextBox Text="{Binding Path=DataContext.Number,
RelativeSource={RelativeSource AncestorType=ContentControl}, UpdateSourceTrigger=PropertyChanged}" />
Unfortunately I can't explain why your version doesn't work.
I have a several tabs on UI where on each tab I need the below:
<StackPanel Orientation="Horizontal">
<Button Content="<" Command="{Binding MoveToPreviousCommand}" />
<TextBlock Text="{Binding SelectedItem.Name}" />
<Button Content=">" Command="{Binding MoveToNextCommand}" />
</StackPanel>
Is there a way to avoid replicating this code in XAML for each tab by specifying the above for example in the Resources only once and pointing into that resource under each tab?
Using ContentControl
<Window.Resources>
<StackPanel x:Key="Content" x:Shared="False" Orientation="Horizontal">
<Button Content="<" Command="{Binding MoveToPreviousCommand}" />
<TextBlock Text="{Binding SelectedItem.Name}" />
<Button Content=">" Command="{Binding MoveToNextCommand}" />
</StackPanel>
<DataTemplate x:Key="template1">
<StackPanel Orientation="Horizontal">
<Button Content="<" Command="{Binding MoveToPreviousCommand}" />
<TextBlock Text="{Binding SelectedItem.Name}" />
<Button Content=">" Command="{Binding MoveToNextCommand}" />
</StackPanel>
</DataTemplate>
</Window.Resources>
<StackPanel>
<ContentControl Content="{StaticResource Content}"></ContentControl>
<ContentControl Name="contCtrl" ContentTemplate="{StaticResource template1}" Content="This is the content of the content control."/>
</StackPanel>
using usercontrol
<UserControl x:Class="WpfApplication2.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel Orientation="Horizontal">
<Button Content="<" Command="{Binding MoveToPreviousCommand}" />
<TextBlock Text="{Binding SelectedItem.Name}" />
<Button Content=">" Command="{Binding MoveToNextCommand}" />
</StackPanel>
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:local="clr-namespace:WpfApplication2">
<Grid>
<local:UserControl1></local:UserControl1>
</Grid>
I got a a few Textblocks and a Datagrid in a grid. The Datagrid vertical scrollbar works fine. But when I put the grid inside a Viewbox the vertical scrollbar disappears. Below is my code
<Window x:Class=MyProject.View.MyTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen"
Title="{Binding FormTitle}" Height="500" Width="800" >
<Window.InputBindings>
<KeyBinding Key="F7" Command="{Binding PrintCommand}" />
</Window.InputBindings>
<Viewbox VerticalAlignment="Top" HorizontalAlignment="Left" Stretch="UniformToFill" >
<Grid Height="Auto" Width="Auto" Name="rootGrid">
<TextBlock Height="12" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBlock1" Text="Job ID:" VerticalAlignment="Top" />
<TextBlock Height="12" HorizontalAlignment="Left" Margin="12,28,0,0" Name="textBlock2" Text="Job Run Time:" VerticalAlignment="Top"/>
<TextBlock Height="12" HorizontalAlignment="Left" Margin="12,45,0,0" Name="textBlock3" Text="Run Number:" VerticalAlignment="Top" />
<TextBlock Height="12" HorizontalAlignment="Left" Margin="12,61,0,0" Name="textBlock4" Text="User Name:" VerticalAlignment="Top" />
<DataGrid CanUserAddRows="False" ItemsSource="{Binding ArchInfo}" AutoGenerateColumns="False"
CanUserDeleteRows="False" CanUserReorderColumns="False"
CanUserSortColumns="True" GridLinesVisibility="All"
ColumnHeaderHeight ="40"
Margin="5,124,5,0" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Table Name" Binding="{Binding Path=TableName, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Table Type" Binding="{Binding Path=TableType, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Status" Binding="{Binding Path=Status, UpdateSourceTrigger=PropertyChanged}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Viewbox>
</Window>
If I add the following to the Datagrid the scrollbar will show but it does not function.
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Visible"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
No matter what I do I can only see part of the Datagrid rows.
Any idea how to resolve this?
Thanks,
The problem has been resolved by Andy's comment.
Setting Datagrid Height and Stretch="Uniform" made it work. See Andy's comment.
I have a DataGrid (the official one) with SelectionUnit="Cell". When the user selects a cell, I'd like to show the row details for the corresponding row. This is apparently not the default behavior, and I can't seem to figure out how to accomplish this.
Here's my XAML:
<UserControl x:Class="View.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../AppResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<DataGrid AutoGenerateColumns="False"
ItemsSource="{Binding Path=Fields}"
BorderBrush="Transparent"
HeadersVisibility="Column"
SelectionMode="Single"
SelectionUnit="Cell"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserSortColumns="False"
IsTextSearchEnabled="True"
x:Name="EntryGrid"
>
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" Width="Auto" IsReadOnly="True"/>
<DataGridTemplateColumn Header="Value" Width="Auto" x:Name="valueColumn" MinWidth="60" MaxWidth="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DisplayValue}" TextTrimming="CharacterEllipsis" ToolTip="{Binding Path=Text, RelativeSource={RelativeSource Self}}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<DockPanel>
<ComboBox TabIndex="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" SelectedValue="{Binding Path=Value, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="Value" ItemsSource="{Binding Path=FieldOptions}" Visibility="{Binding Path=FieldOptions, Converter={StaticResource EmptyCollectionIsInvisibleConverter}}" />
<TextBox TabIndex="2" Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Stretch" Visibility="{Binding Path=FieldOptions, Converter={StaticResource NonEmptyCollectionIsInvisibleConverter}}"/>
</DockPanel>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Description" IsReadOnly="True" Width="*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Help}" />
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</Grid>
</UserControl>
You can set the SelectionUnit to FullRow
SelectionUnit="FullRow"
or you can handle the selection event and set the visibility on event handling.
private void EntryGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
foreach (var cell in e.AddedCells)
((DataGridRow)EntryGrid.ItemContainerGenerator.ContainerFromItem(cell.Item)).DetailsVisibility = System.Windows.Visibility.Visible;
foreach (var cell in e.RemovedCells)
((DataGridRow)EntryGrid.ItemContainerGenerator.ContainerFromItem(cell.Item)).DetailsVisibility = System.Windows.Visibility.Collapsed;
}
Insert disparaging remarks about the WPF DataGrid here.