Windows Presentation Foundation (WPF) ForumHow to use Windows Presentation Foundation (WPF) productively to create visually appealing and differentiating applications and to improve user experience.© 2009 Microsoft Corporation. Alle Rechte vorbehalten.Sun, 29 Nov 2009 12:34:58 Z43e1b4ad-eb8d-427f-90a9-161e7af74457http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/8bcb0e2b-e895-42eb-9fa3-080b05876055http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/8bcb0e2b-e895-42eb-9fa3-080b05876055MarkWBhttp://social.msdn.microsoft.com/Profile/de-DE/?user=MarkWBHaving trouble binding a ComboBox<p><span style="font-family:Courier New">EDIT: I put a combobox on my main window, outside of the HearderedContentControl with the same binding and it works fine.  So it apparently has something to do with being buried in the style of the HeaderedContentControl - something about the way I'm doing the binding is not wiring up correctly.<br/><br/>In my main window I have this XAML:<br/></span></p> <p><span style="color:blue">&lt;</span><span style="color:#a31515">Border</span> <br/>    <span style="color:red">Grid.Column</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">0</span><span style="color:black">&quot;</span> <br/>    <span style="color:red">Style</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource MainBorderStyle}</span><span style="color:black">&quot;</span><br/>    <span style="color:red">Width</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">170</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span><br/><br/>    <span style="color:blue">&lt;</span><span style="color:#a31515">HeaderedContentControl</span><br/>        <span style="color:red">Content</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{Binding Path=Commands}</span><span style="color:black">&quot;</span><br/>        <span style="color:red">ContentTemplate</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource CommandsTemplate}</span><span style="color:black">&quot;</span><br/>        <span style="color:red">Style</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource CommandsHeaderStyle}</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span><br/><span style="color:blue">&lt;/</span><span style="color:#a31515">Border</span><span style="color:blue">&gt;</span><br/><br/>And then in my ResourceDictionary I have this:<br/><span style="color:blue"><br/>&lt;</span><span style="color:#a31515">Style</span> <span style="color:red">x:Key</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">CommandsHeaderStyle</span><span style="color:black">&quot;</span><br/>    <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type HeaderedContentControl}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span><br/><br/>    <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">HeaderTemplate</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span><br/>        <span style="color:blue">&lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span><br/>            <span style="color:blue">&lt;</span><span style="color:#a31515">DataTemplate</span><span style="color:blue">&gt;</span><br/>                <span style="color:blue">&lt;</span><span style="color:#a31515">Border</span> <br/>                    <span style="color:red">Background</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource Brush_HeaderBackground}</span><span style="color:black">&quot;</span> <br/>                    <span style="color:red">BorderBrush</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">LightGray</span><span style="color:black">&quot;</span> <br/>                    <span style="color:red">BorderThickness</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">1</span><span style="color:black">&quot;</span> <br/>                    <span style="color:red">CornerRadius</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">5</span><span style="color:black">&quot;</span> <br/>                    <span style="color:red">Margin</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">4</span><span style="color:black">&quot;</span> <br/>                    <span style="color:red">Padding</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">4</span><span style="color:black">&quot;</span> <br/>                    <span style="color:red">SnapsToDevicePixels</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">True</span><span style="color:black">&quot;</span> <span style="color:blue">&gt;</span><br/>                <span style="color:blue">&lt;</span><span style="color:#a31515">ComboBox</span><br/>                    <span style="color:red">FontSize</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">10</span><span style="color:black">&quot;</span><br/>                    <span style="color:red">HorizontalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Center</span><span style="color:black">&quot;</span>  <br/>                    <span style="color:red">Width</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">100</span><span style="color:black">&quot;</span><br/>                    <span style="color:red">ItemsSource</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{Binding Path=CommandOptions}&quot;  DisplayMemberPath=&quot;DisplayName</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span><br/>                <span style="color:blue">&lt;/</span><span style="color:#a31515">Border</span><span style="color:blue">&gt;</span><br/>            <span style="color:blue">&lt;/</span><span style="color:#a31515">DataTemplate</span><span style="color:blue">&gt;</span><br/>        <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span><br/>    <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;</span><br/>    <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">IsTabStop</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">False</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span><br/><span style="color:blue">&lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;</span><br/><br/>CommandOptions is a public ObservableCollection in my view model.  DisplayName is a public string property on the members of the collection.  For some reason, the combo box is empty at runtime.  What am I doing wrong?</p>Sat, 28 Nov 2009 19:37:17 Z2009-11-29T12:34:56Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/4327ed0e-eb94-4346-a103-a9de7b00d543http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/4327ed0e-eb94-4346-a103-a9de7b00d543t sswhttp://social.msdn.microsoft.com/Profile/de-DE/?user=t%20sswRe-use Cell Template in ListViewI have attempted to re-use a cell template similar to this post (http://social.msdn.microsoft.com/forums/en-US/wpf/thread/7f09f268-2920-423b-ae41-aaf46a13920e/).  However, it does not seem to work for non-string types.  E.g. when the data type is a bool, I get nothing in the cell.  I would like to continue to use this approach as the DataTemplates are quite complicated (code below simplified to show the problem).   Here is a snippet:<br/> <br/> <pre lang=x-xml> &lt;UserControl.Resources&gt;<br/> &lt;DataTemplate x:Key=&quot;ListViewSimpleTemplate&quot;&gt;<br/> &lt;Border Margin=&quot;0,0,-6,0&quot; BorderThickness=&quot;0,0,1,0&quot; BorderBrush=&quot;LightGray&quot; RenderOptions.EdgeMode=&quot;Aliased&quot;&gt;<br/> &lt;TextBlock Text=&quot;{TemplateBinding Content}&quot; VerticalAlignment=&quot;Center&quot; Margin=&quot;0,0,6,0&quot;/&gt;<br/> &lt;/Border&gt;<br/> &lt;/DataTemplate&gt;<br/> &lt;/UserControl.Resources&gt;<br/> <br/> <br/> &lt;ListView Name=&quot;MyList&quot; ItemsSource=&quot;{Binding Path=ViewModelList}&quot; SelectionMode=&quot;Single&quot; Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; AlternationCount=&quot;2&quot;<br/> SelectedItem=&quot;{Binding Path=SelectedItem, Mode=TwoWay}&quot; IsSynchronizedWithCurrentItem=&quot;True&quot;&gt;<br/> &lt;ListView.ItemContainerStyle&gt;<br/> &lt;Style TargetType=&quot;ListViewItem&quot; BasedOn=&quot;{StaticResource ListViewItemBaseStyle}&quot;&gt;<br/> &lt;Setter Property=&quot;HorizontalContentAlignment&quot; Value=&quot;Stretch&quot; /&gt;<br/> &lt;Setter Property=&quot;VerticalContentAlignment&quot; Value=&quot;Stretch&quot; /&gt;<br/> &lt;/Style&gt;<br/> &lt;/ListView.ItemContainerStyle&gt;<br/> &lt;ListView.View&gt;<br/> &lt;GridView&gt;<br/> &lt;GridViewColumn Header=&quot;My Bool&quot;&gt;<br/> &lt;GridViewColumn.CellTemplate&gt;<br/> &lt;DataTemplate&gt;<br/> &lt;ContentControl Content=&quot;{Binding Path=MyBool}&quot; ContentTemplate=&quot;{StaticResource ListViewSimpleTemplate}&quot; /&gt;<br/> &lt;/DataTemplate&gt;<br/> &lt;/GridViewColumn.CellTemplate&gt;<br/> &lt;/GridViewColumn&gt;<br/> &lt;GridViewColumn Header=&quot;Note&quot;&gt;<br/> &lt;GridViewColumn.CellTemplate&gt;<br/> &lt;DataTemplate&gt;<br/> &lt;ContentControl Content=&quot;{Binding Path=Note}&quot; ContentTemplate=&quot;{StaticResource ListViewSimpleTemplate}&quot; /&gt;<br/> &lt;/DataTemplate&gt;<br/> &lt;/GridViewColumn.CellTemplate&gt;<br/> &lt;/GridViewColumn&gt;<br/> </pre>Sat, 28 Nov 2009 07:05:29 Z2009-11-29T12:08:24Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/168d68e6-88af-4874-a5f0-d68c34f4d7aahttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/168d68e6-88af-4874-a5f0-d68c34f4d7aaTom McGuinnesshttp://social.msdn.microsoft.com/Profile/de-DE/?user=Tom%20McGuinnessCannot click Button belonging to DataTemplate within nested ItemsControl I've created a UserControl that I'm hosting within an Outlook Region using VSTO. <div><br/></div> <div>This user control contains an ItemsControl called validatorList to which I bind a list of ValidationRule objects. The binding is performed in code. I've also omitted some of the attributes for readability.</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">&lt;</span><span style="color:#A31515">ItemsControl</span> <span style="color:Red">x:Name</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">validatorList</span><span style="color:Black">&quot;</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ItemsControl.ItemsPanel</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ItemsPanelTemplate</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">WrapPanel</span> <span style="color:Red">Orientation</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Horizontal</span><span style="color:Black">&quot;</span> <span style="color:Red">HorizontalAlignment</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Stretch</span><span style="color:Black">&quot;</span> <span style="color:Red">VerticalAlignment</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Stretch</span><span style="color:Black">&quot;</span> <span style="color:Red">IsItemsHost</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">True</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">ItemsPanelTemplate</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">ItemsControl.ItemsPanel</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">ItemsControl</span><span style="color:Blue">&gt;</span> </pre> </div> I use a DataTemplate to style the ValidationRule object. This displayed the ValidationRule in a nice border.</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre> <span style="color:Blue">&lt;</span><span style="color:#A31515">DataTemplate</span> <span style="color:Red">DataType</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">{x:Type validation:ValidationRule}</span><span style="color:Black">&quot;</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Border</span> <span style="color:Red">CornerRadius</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">5</span><span style="color:Black">&quot;</span> <span style="color:Red">Background</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">White</span><span style="color:Black">&quot;</span> <span style="color:Red">BorderBrush</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Black</span><span style="color:Black">&quot;</span> <span style="color:Red">BorderThickness</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">2</span><span style="color:Black">&quot;</span> <span style="color:Red">Margin</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">4</span><span style="color:Black">&quot;</span> <span style="color:Red">Height</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Auto</span><span style="color:Black">&quot;</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Border.BitmapEffect</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">DropShadowBitmapEffect</span><span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">Border.BitmapEffect</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">StackPanel</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Grid</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Grid.ColumnDefinitions</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ColumnDefinition</span> <span style="color:Red">Width</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">*</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ColumnDefinition</span> <span style="color:Red">Width</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">20</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">Grid.ColumnDefinitions</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">TextBlock</span> <span style="color:Red">Text</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">{Binding Name, Mode=Default, FallbackValue=Rule Name}</span><span style="color:Black">&quot;</span> <span style="color:Red">Grid.Column</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">0</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Button</span> <span style="color:Red">Content</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">X</span><span style="color:Black">&quot;</span> <span style="color:Red">ToolTip</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Close this validation</span><span style="color:Black">&quot;</span> <span style="color:Red">Grid.Column</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">1</span><span style="color:Black">&quot;</span> <span style="color:Red">IsEnabled</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">False</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">Grid</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">TextBlock</span> <span style="color:Red">Text</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">{Binding IsValid, Mode=OneWay, FallbackValue=True}</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ItemsControl</span> <span style="color:Red">Height</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Auto</span><span style="color:Black">&quot;</span> <span style="color:Red">VerticalAlignment</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Stretch</span><span style="color:Black">&quot;</span> <span style="color:Red">ItemsSource</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">{Binding Path=Statuses}</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">StackPanel</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">Border</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">DataTemplate</span><span style="color:Blue">&gt;</span> </pre> </div> The Statuses property of the ValidationRule object is a list of ValidationStatus objects. These are then styled using another data template.</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">&lt;</span><span style="color:#A31515">DataTemplate</span> <span style="color:Red">DataType</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">{x:Type validation:ValidationStatus}</span><span style="color:Black">&quot;</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Grid</span> <span style="color:Red">Margin</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">2</span><span style="color:Black">&quot;</span> <span style="color:Red">HorizontalAlignment</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Stretch</span><span style="color:Black">&quot;</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Grid.ColumnDefinitions</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ColumnDefinition</span> <span style="color:Red">Width</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Auto</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ColumnDefinition</span> <span style="color:Red">Width</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">*</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">ColumnDefinition</span> <span style="color:Red">Width</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Auto</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">Grid.ColumnDefinitions</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Image</span> <span style="color:Red">x:Name</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">typeImage</span><span style="color:Black">&quot;</span> <span style="color:Red">Margin</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">0,0,5,0</span><span style="color:Black">&quot;</span> <span style="color:Red">Grid.Column</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">0</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">TextBlock</span> <span style="color:Red">Text</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">{Binding Message, Mode=OneWay</span><span style="color:Black">&quot;</span> <span style="color:Red">HorizontalAlignment</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Left</span><span style="color:Black">&quot;</span> <span style="color:Red">Grid.Column</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">1</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">Button</span> <span style="color:Red">Grid.Column</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">2</span><span style="color:Black">&quot;</span> <span style="color:Red">Margin</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">4,0,0,0</span><span style="color:Black">&quot;</span> <span style="color:Red">Content</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">Action</span><span style="color:Black">&quot;</span> <span style="color:Red">Click</span><span style="color:Blue">=</span><span style="color:Black">&quot;</span><span style="color:Blue">ExecuteAction</span><span style="color:Black">&quot;</span> <span style="color:Blue">/&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">Grid</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;</span><span style="color:#A31515">DataTemplate.Triggers</span><span style="color:Blue">&gt;</span> .... triggers left out .... <span style="color:Blue">&lt;/</span><span style="color:#A31515">DataTemplate.Triggers</span><span style="color:Blue">&gt;</span> <span style="color:Blue">&lt;/</span><span style="color:#A31515">DataTemplate</span><span style="color:Blue">&gt;</span> </pre> </div> This all runs and renders correctly with the list of ValidationStatus objects being displayed within each ValiadationRule.</div> <div><br/></div> <div>However, I cannot click the button displayed by the ValidationStatus template! It's rendered, but moving the mouse over it doesn't trigger the glowing button effect.</div> <div>If I add MouseEnter and MouseLeave events to the button they will be fired but the Click event is never raised. My thinking is that an underlying object is cancelling the click during a PreviewMouseDown but I can't think what.</div> <div><br/></div> <div>Can anyone shed any light on this for me? </div>Sun, 29 Nov 2009 11:50:01 Z2009-11-29T11:50:02Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/5c5125db-1a99-44bd-90d7-d408833199f7http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/5c5125db-1a99-44bd-90d7-d408833199f7Dmitriy Scherbakhttp://social.msdn.microsoft.com/Profile/de-DE/?user=Dmitriy%20ScherbakDrag and Drop buttons in WPF<p>Hello everyone!</p> <p>Can you help me? I have the shuffle word like: eahd (head), I need to create the buttons with this letters and a sections where they have to be put. If the button is placed in the wrong position, it glows red else green. I just started to learn WPF... And if person wrong collected word, he can recollected it the same way.</p> <p>Thanks for answers!</p>Sun, 29 Nov 2009 11:35:17 Z2009-11-29T11:35:18Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/e61dc269-00b0-4fab-b6c6-8b4b9cac9659http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/e61dc269-00b0-4fab-b6c6-8b4b9cac9659Theo Stormhttp://social.msdn.microsoft.com/Profile/de-DE/?user=Theo%20StormWPF Ribbon pixelates application button iconHey guys, I'm using the WPF Ribbon in my application, and I have my .png 16x16 icon that I want to use for the application button - however, when I apply it, it pixelates completely! Here's the icon: http://goos.se/Logo/index.htm<br/> <br/> Here's a picture of what I mean: http://i48.tinypic.com/1051eoo.jpg<br/> I highlighted the area with a thick red line.<br/> <br/> Thanks for any help you can give,<br/> TheoSun, 29 Nov 2009 10:22:26 Z2009-11-29T10:22:26Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/c39311e6-43b3-46e5-af00-19c8baf5d03chttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/c39311e6-43b3-46e5-af00-19c8baf5d03cmonkey8888zhttp://social.msdn.microsoft.com/Profile/de-DE/?user=monkey8888zMake WPF window stay on top <span style="font-size:x-small"> <p>What's the best way to make sure a WPF window stays on top in all circumstances. I have tried setting Topmost = true; but it still gets hidden from time to time.</p> <p>I also tried the API function SetWindowPos with HWND_TOPMOST.</p> <p>The window in question is an additional WPF  window created by the main application window.<br/><br/>Many thanks</p> </span>Sat, 28 Nov 2009 19:43:59 Z2009-11-29T10:19:34Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/a7b3a9a4-3878-4e94-9fd2-e24e9d94e583http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/a7b3a9a4-3878-4e94-9fd2-e24e9d94e583Jagadeesanhttp://social.msdn.microsoft.com/Profile/de-DE/?user=JagadeesanTreeview in WPF<p>I'am using Treeview control. My requirement is if the user selects a node, the properties will be visible in a panel and it will be editable.<br/><br/>If the user edits one node and trying to select another node without saving the first node, i will throw a warning message with 'yes/no' option. But this message box on selection changed event makes the tree to select the parent node. How can i eradicate this?</p>Sun, 29 Nov 2009 09:57:21 Z2009-11-29T09:57:21Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/f7a8cabb-8388-4e64-ad91-834d157e9799http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/f7a8cabb-8388-4e64-ad91-834d157e9799marck68http://social.msdn.microsoft.com/Profile/de-DE/?user=marck68how to replace the character " in a string via vb?Hello<br/> <br/> I need to replace the character  &quot;  in a string in VB how can i do that?Sun, 29 Nov 2009 09:19:30 Z2009-11-29T09:19:30Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/efd1a7ef-f893-408d-995a-743f9e36a8fehttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/efd1a7ef-f893-408d-995a-743f9e36a8femarck68http://social.msdn.microsoft.com/Profile/de-DE/?user=marck68SCREEN COORDINATES and scaletransform in wpfHello<br/> <br/> I am working on a application where the screen coordinates are used to locate the position of some objects and then, one done ,it draws a line between these objects.<br/> <br/> All work well until i use a scaletransform on the container that contains all the objects to be joined.<br/> <br/> When I use a scale transform different from  all goes bonker.   The lines do not join any more the objects<br/> <br/> any idea why this happens? <br/> <br/> <br/> The project has a big canvas main container whit many other canvas that contains the objects to be joined by lines.Sun, 29 Nov 2009 08:27:42 Z2009-11-29T08:27:42Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/e3590a21-0972-47b0-b8bd-a04f37d0aa58http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/e3590a21-0972-47b0-b8bd-a04f37d0aa58learningWPFhttp://social.msdn.microsoft.com/Profile/de-DE/?user=learningWPFReporting with WPF<p>Hi all</p> <p>What is intended to do reporting with WPF ?   FlowDocument ?</p> <p> Are there any third part building some report tool based in WPF ?</p> <p> </p> <p> </p> <p> </p>Tue, 30 May 2006 08:41:49 Z2009-11-29T07:56:40Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/86c30ccc-b66f-46e9-ba16-e108b2ed5ffbhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/86c30ccc-b66f-46e9-ba16-e108b2ed5ffbVintageDeveloperhttp://social.msdn.microsoft.com/Profile/de-DE/?user=VintageDeveloperUnable to Get Element Inside DataTemplateI read through the &quot;WPF XAML Namespaces&quot; article at http://msdn.microsoft.com/en-us/library/ms746659.aspx so I thought I understood the namescoping issues involved in obtaining elements inside templates, but I am still unable to get it to work.<br/> <br/> For instance, I have the following deliberately-simplistic XAML which creates a TabControl and a Button under it. The TabControl’s resources include a DataTemplate, intended for use with TabItems. When the Button is clicked, it should add a new TabItem, templated on the DataTemplate, to the TabControl:<br/> <br/> <br/> <pre lang=x-xml>&lt;Window x:Class=&quot;Test.wndMain&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:src=&quot;clr-namespace:Test&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; Height=&quot;300&quot; Width=&quot;300&quot;&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height=&quot;4*&quot;/&gt; &lt;RowDefinition Height=&quot;*&quot;/&gt; &lt;/Grid.RowDefinitions&gt; &lt;TabControl Grid.Row=&quot;0&quot; Name=&quot;ctrlTab_Room&quot;&gt; &lt;TabControl.Resources&gt; &lt;DataTemplate x:Key=&quot;templTab_Cabinet&quot;&gt; &lt;TextBlock Name=&quot;txtCup&quot;/&gt; &lt;/DataTemplate&gt; &lt;/TabControl.Resources&gt; &lt;/TabControl&gt; &lt;Button Grid.Row=&quot;1&quot; Name=&quot;btnAddNewCabinet&quot; Click=&quot;btnAddNewCabinet_Click&quot; Content=&quot;Add New Cabinet&quot;/&gt; &lt;/Grid&gt; &lt;/Window&gt;</pre> <br/> <br/> Now, I have a Cabinet.cs class file which defines the bare-bones Cabinet class:<br/> <br/> <br/> <pre lang="x-c#">using System; namespace Test { class Cabinet { } }</pre> <br/> <br/> <br/> And in the code-behind for the window, I have (the code is roughly based on and modified from Microsoft’s own example code given at http://msdn.microsoft.com/en-us/library/system.windows.frameworktemplate.findname.aspx):<br/> <br/> <br/> <pre lang="x-c#">using System; using System.Windows; // Necessary for windows using System.Windows.Controls; // Necessary for controls using System.Windows.Media; // Necessary for VisualTreeHelper namespace Test { public partial class wndMain : Window { public wndMain() { InitializeComponent(); } private void btnAddNewCabinet_Click(object objSender, RoutedEventArgs args) { // Create cabinet tab TabItem tabCabinet_New = new TabItem(); tabCabinet_New.ContentTemplate = (DataTemplate)ctrlTab_Room.FindResource(&quot;templTab_Cabinet&quot;); tabCabinet_New.Content = new Cabinet(); // Get cup in cabinet tabCabinet_New.ApplyTemplate(); ContentPresenter objContentPresenter = FindVisualChild&lt;ContentPresenter&gt;(tabCabinet_New); DataTemplate templTab_Cabinet = objContentPresenter.ContentTemplate; TextBlock txtCup = (TextBlock)(templTab_Cabinet. FindName(&quot;txtCup&quot;, objContentPresenter)); txtCup.Text = &quot;foobar&quot;; // Add cabinet to room ctrlTab_Room.Items.Add(tabCabinet_New); } private childItem FindVisualChild&lt;childItem&gt;(DependencyObject obj) where childItem : DependencyObject { for (int i = 0; i &lt; VisualTreeHelper.GetChildrenCount(obj); i++) { DependencyObject child = VisualTreeHelper.GetChild(obj, i); if (child != null &amp;&amp; child is childItem) return (childItem)child; else { childItem childOfChild = FindVisualChild&lt;childItem&gt;(child); if (childOfChild != null) return childOfChild; } } return null; } } }</pre> <br/> <br/> <br/> When I run this and try to click the button, I get a NullReferenceException at the FindName() line in the button handler because templTab_Cabinet is null. I tried changing the<br/> <br/> <br/> <pre lang="x-c#">DataTemplate templTab_Cabinet = objContentPresenter.ContentTemplate;</pre> <br/> <br/> line to:<br/> <br/> <br/> <pre lang="x-c#">DataTemplate templTab_Cabinet = tabCabinet_New.ContentTemplate;</pre> <br/> <br/> or to:<br/> <br/> <br/> <pre lang="x-c#">DataTemplate templTab_Cabinet = (DataTemplate)(ctrlTab_Room.FindResource(&quot;templTab_Cabinet&quot;));</pre> <br/> <br/> instead, but either way instead gets me an InvalidOperationException (&quot;This operation is valid only on elements that have this template applied.&quot;) on the FindName() line.<br/> <br/> How can I get this to work? What am I doing wrong? Thanks in advance.<br/>Tue, 03 Nov 2009 23:44:52 Z2009-11-29T03:43:36Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/00fe4606-404d-41ad-9dc1-57265a45f42dhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/00fe4606-404d-41ad-9dc1-57265a45f42dprogamehttp://social.msdn.microsoft.com/Profile/de-DE/?user=progamememory leak when click menucreate a window with menu control, new and close it, then call GC.collect.<br/>if you don't click menu, this window can destroy, but if you click any menu, then it can't be destroy.Fri, 06 Nov 2009 16:31:21 Z2009-11-29T03:17:33Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/68bab24d-73d9-40a1-8edc-819441fa077ahttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/68bab24d-73d9-40a1-8edc-819441fa077aRussell_Eubankshttp://social.msdn.microsoft.com/Profile/de-DE/?user=Russell_EubanksGrouping with the WPF DataGrid control<p>I'm trying to do two-level grouping within a WPF DataGrid. Assuming my data looks like this:<br/><br/><span style="font-family:Courier New;font-size:x-small"><span style="font-family:Courier New;font-size:x-small">Program1 Type1 Description1<br/>Program1 Type1 Description2<br/>Program1 Type2 Description3<br/>Program1 Type2 Description4<br/>Program2 Type1 Description5<br/>Program2 Type1 Description6<br/>Program2 Type2 Description7</span></span><span style="font-size:x-small"><br/></span>etc.<br/><br/>I want my data to group first by Program and then by Type. In my code, I create the groupings and set the ItemsSource property of the DataGrid:</p> <span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"><font face=Consolas size=2><font face=Consolas size=2> <p>HouseholdServiceHistory _serviceHistory = HouseholdServiceHistory.GetHouseholdServiceHistory(householdID, monthCount,</p> </font></font></span><font face=Consolas size=2> <p> </p> </font></span> <p><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"> </span></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">serviceCount);<br/>ICollectionView _view = CollectionViewSource.GetDefaultView(_serviceHistory);<br/>_view.GroupDescriptions.Clear();<br/>_view.GroupDescriptions.Add(new PropertyGroupDescription(&quot;ProgramDescription&quot;));<br/>_view.GroupDescriptions.Add(new PropertyGroupDescription(&quot;ServiceType&quot;));<br/>this.dataGridHouseholdServiceHistory.ItemsSource = _view;</span></span></p> <span style="font-family:Times New Roman"> <p>In the XAML for my form I have the DataGrid:</p> </span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"><font face=Consolas size=2><font face=Consolas size=2> <p>&lt;DataGrid Name=&quot;dataGridHouseholdServiceHistory&quot;</p> </font></font></span><font face=Consolas size=2> <p> </p> </font></span> <p><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">AutoGenerateColumns=&quot;False&quot;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">Style=&quot;{StaticResource dataGridStyle}&quot; &gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGrid.GroupStyle&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;GroupStyle&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;GroupStyle.HeaderTemplate&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataTemplate&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;Label&gt;Program&lt;/Label&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;TextBox Text=&quot;{Binding Path=ProgramDescription}&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;/StackPanel&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;/DataTemplate&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;/GroupStyle.HeaderTemplate&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;/GroupStyle&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;/DataGrid.GroupStyle&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGrid.Columns&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=ProgramDescription}&quot; Header=&quot;Program&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=ServiceType}&quot;</span></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"> H</span></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">eader=&quot;Service Type&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=ServiceDescription}&quot;<br/></span></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">Header</span></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">=&quot;Description&quot;/&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=LocationDescription}&quot; Header=&quot;Location&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=ServiceDate, StringFormat=d}&quot; <br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">Header=&quot;Date&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=ServiceValue}&quot; Header=&quot;Value&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=NumberOfAdults}&quot; Header=&quot;Adults&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;DataGridTextColumn Binding=&quot;{Binding Path=NumberOfChildren}&quot; Header=&quot;Children&quot; /&gt;<br/></span></span><span style="font-family:Consolas;font-size:x-small"></span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">&lt;/DataGrid.Columns&gt;<br/>&lt;/DataGrid&gt;</span></span></p> <span style="font-family:Times New Roman"> <p>I think my problem is with the XAML. Obviously, I'm not sure what to do with the second grouping as far as GroupStyle. Also, this example shows the grouping columns as DataGrid columns as well as Grouping headers, and I would remove them as grid columns if the grouping headers are working. So how do I use DataGrid Grouping to display the data the way I've specified?</p> </span><span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"> <p> </p> </span></span> <p> </p> <p> </p> <span style="font-family:Calibri;font-size:small"><span style="font-family:Calibri;font-size:small"><font face=Calibri size=3><font face=Calibri size=3><span> <p> </p> </span></font></font></span><font face=Calibri size=3></font></span>Sun, 29 Nov 2009 02:52:12 Z2009-11-29T02:52:14Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/1bf01a90-e7b6-48e6-b0a4-1ad8f305ba0chttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/1bf01a90-e7b6-48e6-b0a4-1ad8f305ba0cRussell_Eubankshttp://social.msdn.microsoft.com/Profile/de-DE/?user=Russell_EubanksBinding to XML in WPFI have an XML column in a table in a SQL Server database. I want to read this column, then two-way databind its fields into WPF controls or a WPF DataGrid. What is the best .NET object to use for this and what would be the proper syntax? I'm using VS 2010 Beta 2.Fri, 13 Nov 2009 03:24:42 Z2009-11-29T02:22:16Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/0e19cd2d-50c6-4541-b7a0-4146ddc179e9http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/0e19cd2d-50c6-4541-b7a0-4146ddc179e9bobjinkhttp://social.msdn.microsoft.com/Profile/de-DE/?user=bobjinkImage of usercontrolHi<br/> <br/> Is there an easy way to make a picture at runtime on a usercontrol and then change the size of it?<br/> Have not found anything about it.<br/> <br/> Thanks!Sat, 28 Nov 2009 22:15:36 Z2009-11-29T01:25:15Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/a7349eef-a302-425e-8a0d-b7e52cd88b25http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/a7349eef-a302-425e-8a0d-b7e52cd88b25MikeHiltonhttp://social.msdn.microsoft.com/Profile/de-DE/?user=MikeHiltonHow to automatically update bound targets from a database data source?Although I keep seeing posts and such that I interpret as saying this is possible, I still have not been able to figure it out. . . <br/><br/>From an WPF application, I have elements bound via a datasource to an Access database, which was simple enough.  The WPF app does not need to update the database, but is merely displaying information via sliders and labels from the database.  However, the database is constantly being updated by a completely separate application.<br/><br/>How do I make the elements &quot;automatically&quot; update from the changes taking place in the database?<br/><br/>Thanks.Sun, 29 Nov 2009 00:15:58 Z2009-11-29T00:15:59Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/14466080-5fcd-496d-a285-394b6f787dd7http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/14466080-5fcd-496d-a285-394b6f787dd7Kofoedhttp://social.msdn.microsoft.com/Profile/de-DE/?user=KofoedPopup with AllowsTransparency="True" is allowing click events to pass through?I have a Popup with the AllowsTransparency property set to true, and I'm defining a custom border (rounded edges) for it.  I have a ListBox on the popup ... the problem is that when I click on an item in the listbox, the mouse click goes through the popup and ends up putting focus or clicking on a control that happens to be underneath the popup.<br/><br/>Is there a way around this?  I tried adding another Grid layer below the ListBox that had IsHitTestVisible=&quot;False&quot;, but that didn't work.Tue, 24 Nov 2009 18:44:44 Z2009-11-28T23:34:46Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/de75cebe-3681-43cb-8c85-266ac7bced62http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/de75cebe-3681-43cb-8c85-266ac7bced62bhagyesh joshihttp://social.msdn.microsoft.com/Profile/de-DE/?user=bhagyesh%20joshiBinding with own class propertyHello friends,<br/>         I am facing a trouble. I want to attach my textbox with a String property of the same class. For an example in my Window.xaml there is a textbox named txtUserName and in its code behind file Window.xaml.cs there's property named UserName(type of string). I want to bind this property with the textbox's Text property. So is it possible..?<br/> <br/> Thnx in advanced.<br/> <br/><hr class="sig">destinySat, 28 Nov 2009 09:01:30 Z2009-11-28T19:13:47Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/8f1c30ae-eec3-4d59-9c24-b178533db2a7http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/8f1c30ae-eec3-4d59-9c24-b178533db2a7marck68http://social.msdn.microsoft.com/Profile/de-DE/?user=marck68which are the forbidden characters in xaml codewhere can I find the list of forbidden characters in xaml code??Fri, 27 Nov 2009 14:38:42 Z2009-11-28T18:59:45Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/8add70a3-6c43-417c-8e85-9d3be36057cehttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/8add70a3-6c43-417c-8e85-9d3be36057cek0065126http://social.msdn.microsoft.com/Profile/de-DE/?user=k0065126Trying to find an alternative to VBs InputBox<span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> <p>If I was using Visual Basic I would write :-</p> <p>string message = &quot;Choose one option&quot;;<br/>if (option1) message = message + &quot;1 This is one option&quot;;<br/>if (option2) message = message + &quot;2 Another option&quot;;<br/>...<br/>if (option5) message = message + &quot;5 Last option&quot;;</p> <p>int choice = InputBox(message);</p> <p>switch (choice)<br/>   case 1<br/>      code for case 1;<br/>  ...<br/>  case 5<br/>      code for case 5;<br/>end of switch statements</p> <p>This does not seem to be possible in WPF or C#.  I did wonder if using a pop-up form would be possible but could not work out if the form could pass a parameter back to the originating method.</p> <p>I am now trying to use a list box but cannot work out how to add an event handler at run time.<br/>What I have in XAML is :-</p> <p>&lt;ListBox Height=&quot;85&quot; Margin=&quot;663,0,700,350&quot; Name=&quot;listBox1&quot; VerticalAlignment=&quot;Bottom&quot; FontSize=&quot;14&quot; Visibility=&quot;Hidden&quot;&gt;</p> <p>&lt;ListBoxItem Selected=&quot;ListBoxItem_Selected&quot;&gt;The options are :-&lt;/ListBoxItem&gt;</p> <p>&lt;/ListBox&gt; <br/> </p> <p>And in my code I have :-</p> <p>if (option1)<br/> {<br/> listBox1.Items.Add(&quot;text for option 1&quot;);</p> <p> listBox1.SelectedItem +=</p> <p> new EventHandler(void (ListBoxItem1_Selected) ); // this causes an error <br/> }<br/>...<br/>if (option5)<br/> {<br/> listBox1.Items.Add(&quot;text for option 5&quot;);</p> <p> listBox1.SelectedItem +=</p> <p> new EventHandler((ListBoxItem5_Selected) ); //  nor does this <br/>  <br/> }</p> <p>I am trying to find out how to add an event handler which will be callled if the item in the list is selected.<br/>Although I could hard code the list items and hide those which are not relevant this does not look very good, and the list items will probably be different each time I call the code.</p> <p>I hope that someone can help, and that I have explained myself clearly,</p> <p>Viv</p> </span></span>Fri, 27 Nov 2009 19:50:14 Z2009-11-28T17:33:11Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/98e39986-a100-449a-8f3e-c2553f299a4chttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/98e39986-a100-449a-8f3e-c2553f299a4ctomasz.82http://social.msdn.microsoft.com/Profile/de-DE/?user=tomasz.82drag n drop from thunderbird 3Hi,<br/> I develope c# application with drag &amp; drop functionality. In thunderbird 2 evertything works fine but in new rc version I can not drag an attachment to my application. The function :<br/>  MemoryStream ms = (MemoryStream)e.Data.GetData(&quot;FileContents&quot;, true);<br/> allways retunrs null. Is there any way to drag attachments from thunderbird 3?Sat, 28 Nov 2009 17:05:35 Z2009-11-28T17:05:35Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/a80153f8-dcf7-4b18-a8b9-5aa328c9d339http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/a80153f8-dcf7-4b18-a8b9-5aa328c9d339JRichTXhttp://social.msdn.microsoft.com/Profile/de-DE/?user=JRichTXListView ItemsPresenter Scrolling with GroupStyle specified<p>I have implemented Grouping with a ListView in which I wrap the ItemsPresenter in an Expander like follows<br/><br/>&lt;ListView.GroupStyle&gt;<br/>                    &lt;GroupStyle&gt;<br/>                        &lt;GroupStyle.ContainerStyle&gt;<br/>                            &lt;Style TargetType=&quot;{x:Type GroupItem}&quot;&gt;<br/>                                &lt;Setter Property=&quot;Margin&quot; Value=&quot;0,0,0,5&quot;/&gt;<br/>                                &lt;Setter Property=&quot;Template&quot;&gt;<br/>                                    &lt;Setter.Value&gt;<br/>                                        &lt;ControlTemplate TargetType=&quot;{x:Type GroupItem}&quot;&gt;<br/>                                            &lt;Expander IsExpanded=&quot;True&quot; <br/>                                                      BorderBrush=&quot;Black&quot; <br/>                                                      BorderThickness=&quot;0,0,0,1&quot; <br/>                                                      Expanded=&quot;Expander_Expanded&quot; <br/>                                                      Collapsed=&quot;Expander_Collapsed&quot; <br/>                                                      ScrollViewer.CanContentScroll=&quot;True&quot; &gt;<br/>                                                &lt;Expander.Header&gt;<br/>                                                    &lt;TextBlock Text=&quot;{Binding Path=Name}&quot; Style=&quot;{DynamicResource gvHeaderStyle}&quot; /&gt;<br/>                                                &lt;/Expander.Header&gt;<br/>                                                &lt;Expander.Content&gt;<br/>                                                    &lt;Border Background=&quot;White&quot; Margin=&quot;2&quot; CornerRadius=&quot;3&quot;&gt;<br/>                                                        &lt;ItemsPresenter/&gt;<br/>                                                    &lt;/Border&gt;<br/>                                                &lt;/Expander.Content&gt;<br/>                                            &lt;/Expander&gt;<br/>                                        &lt;/ControlTemplate&gt;<br/>                                    &lt;/Setter.Value&gt;<br/>                                &lt;/Setter&gt;<br/>                            &lt;/Style&gt;<br/>                        &lt;/GroupStyle.ContainerStyle&gt;<br/>                    &lt;/GroupStyle&gt;<br/>                &lt;/ListView.GroupStyle&gt;<br/><br/>This code works fine with one problem. The contents of the ItemsPresenter are not scrollable. I have tried everything I can think of to make the ItemsContent scroll, but no luck. Is there a way to make the contents of the expander scrollable in this case?</p>Sat, 28 Nov 2009 16:51:27 Z2009-11-28T16:51:28Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/966fa1f5-b818-45d7-b2f3-0ebd75de7d8ahttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/966fa1f5-b818-45d7-b2f3-0ebd75de7d8aMarkReynhttp://social.msdn.microsoft.com/Profile/de-DE/?user=MarkReynDataGridView auto resize cell as user typesI'm using a DataGridView with a column that will be used to capture text. I have a column that will be used to capture text and I have the Column's Cell Style Wrap Mode set to True and the DataGridView's AutoSizeRowsMode set to AllCells. Right now, the grid only resizes the height of the row when the user finishes editing and leaves the cell. I need the row height to automatically resize as the user enters text. <div><br/></div> <div>Any suggestions? Samples? Are there other grids that provide this behavior?</div> <div><br/></div> <div>thanks for the help</div>Sat, 28 Nov 2009 16:08:30 Z2009-11-28T16:08:31Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/d6da1f1e-9b46-41d8-83e3-d61c9c74491dhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/d6da1f1e-9b46-41d8-83e3-d61c9c74491dengnounahttp://social.msdn.microsoft.com/Profile/de-DE/?user=engnounaHighLight a specific cell in DataGridHi<br/><br/>I have 3 DataGrid bound to the same datatable but each DataGrid displays different columns,When the user selects a row in any datagrid, I want to select this row in the other datagrids.In other words,if Grid1.SelectedIndex is 5, then Grid2.selectedIndex should be = 5 and Grid3.selectedIndex should be = 5,I tried Grid2.selectedIndex = Grid1.SelectedIndex but I noticed that the row in Grid2 is not selected<br/><br/>Any tips?<br/><br/>thanksSat, 28 Nov 2009 11:13:36 Z2009-11-28T13:51:26Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/53ca5ffe-b50b-46fd-b019-47a42970375bhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/53ca5ffe-b50b-46fd-b019-47a42970375btomer70http://social.msdn.microsoft.com/Profile/de-DE/?user=tomer70mvvm-aggregating ViewModels?<p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Times New Roman;font-size:small"><br/> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">Hi,</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"><br/>Is it common to aggregate ViewModels into a new ViewModel?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">Suppose I have two ViewModels:</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">1.ImageViewModel</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">2.PositionViewModel</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The ImageViewModel containing a description ,a URL to an image, and a key</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The PositionViewModel containing a key (identifying an image) and a Point.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The result should be displaying images based on a position</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The connection between the Position and the Image is made using the key.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">1. Is aggregating both ViewModel into <strong>ImageAndPositionViewModel</strong> is a good idea in general?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">2. <span style=""> </span>Do I really need the ImageViewModel and PositionViewModel at all?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"><span style="">    </span>Isn’t enough to create an ImageAndPositionViewModel assuming I always only want display the image based on its position?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">3. In general Should a ViewModel communicate with other Models using the other   model's ViewModel? </span><span style="font-family:Consolas"><span style="">for example  </span>Should ImageViewModel use <span style=""> </span>PositionViewModel or can directly use Position?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> Thanks in advance.<br/></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"><br/> </span></p> <font face="Times New Roman" size=3> <p class=MsoNormal style="margin:0cm 0cm 0pt"> </p> </font></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"> </p>Sat, 28 Nov 2009 12:40:38 Z2009-11-28T13:54:27Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/f96fa37c-aa1b-43af-9695-69c518950582http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/f96fa37c-aa1b-43af-9695-69c518950582Failurehttp://social.msdn.microsoft.com/Profile/de-DE/?user=FailureCannot recover from ArgumentOutOfRangeException - but why?When I set the Indices property of a <strong>Glyphs</strong> object to an invalid value, I get an ArgumentOutOfRangeException.<br/>That's fair enough. But if I do that in a try block and handle the exception in its catch-clause, <strong>why is it that I am <em>not</em> allowed to handle that exception but my program gets shot down anyway?</strong> (If I use the debugger I can see that my program never even reaches the catch clause - the program gets just shot down in what I consider a rather unfriendly manner.)<br/><br/>Also: <strong>Is there a way that I can figure out which indices are valid for a given font / Glyphs.Index by inspecting the Glyphs object programmatically</strong> before even attempting to set its Indices property?<br/><br/>Thanks in advance for any ideas,<br/>FailureFri, 27 Nov 2009 20:44:53 Z2009-11-28T11:50:30Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/0fd10bc3-89d5-419f-8a8b-cf7a39799e65http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/0fd10bc3-89d5-419f-8a8b-cf7a39799e65NoNameNoOnehttp://social.msdn.microsoft.com/Profile/de-DE/?user=NoNameNoOneHow to retrieve image path from mysql and display it?hi guys, i'm new in WPF C#.<br/> I'm wondering how to retrieve image by image path from mysql database and display on screen?<br/> <br/> Thanks for helping...<br/>Sat, 28 Nov 2009 11:40:07 Z2009-11-28T11:40:07Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/29b4cd22-b60f-4980-bb8f-1092a12b7823http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/29b4cd22-b60f-4980-bb8f-1092a12b7823Jetsunhttp://social.msdn.microsoft.com/Profile/de-DE/?user=JetsunWhy the IsEnabled for the style of ComboBoxItem does not work unless the dropdown list is showed?Following is the XAML and data, the IsEnabled property of ComboboxItem is binding to the value in the data.<br/> The disabled item still can be selected when user roll the mouse wheel in the textbox of ComboBox.<br/> But after the dropdown list is showed, then the disabled items will not be able to selected by scroll the mouse wheel in the textbox of combobox.<br/> <br/> There is another problem, the disabled item can be selected if the combobox is Editable, and user input the disabled item.<br/> <br/> <pre lang=x-xml> &lt;Window.Resources&gt; &lt;ResourceDictionary&gt; &lt;Style TargetType=&quot;{x:Type ComboBoxItem}&quot;&gt; &lt;Setter Property=&quot;IsEnabled&quot; Value=&quot;{Binding Path =[1]}&quot;/&gt; &lt;/Style&gt; &lt;/ResourceDictionary&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;ComboBox Margin=&quot;46,72,31,0&quot; Name=&quot;ComboBox1&quot; Height=&quot;28&quot; VerticalAlignment=&quot;Top&quot; IsEditable=&quot;True&quot; TextSearch.TextPath=&quot;[0]&quot; DisplayMemberPath=&quot;[0]&quot; SelectedValuePath=&quot;[0]&quot; &gt; &lt;/ComboBox&gt;</pre> <pre lang=x-vbnet> Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Dim combList As New List(Of String()) combList.Add(New String() {&quot;1 Item1&quot;, &quot;True&quot;}) combList.Add(New String() {&quot;2 Item2&quot;, &quot;False&quot;}) combList.Add(New String() {&quot;3 Item3&quot;, &quot;True&quot;}) combList.Add(New String() {&quot;4 Item4&quot;, &quot;False&quot;}) combList.Add(New String() {&quot;5 Item5&quot;, &quot;True&quot;}) Me.ComboBox1.ItemsSource = combList End Sub</pre>Tue, 24 Nov 2009 03:51:24 Z2009-11-28T11:38:03Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/3ed11dbe-7b30-46ff-8ce4-4d1096eb5628http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/3ed11dbe-7b30-46ff-8ce4-4d1096eb5628wg1989johnhttp://social.msdn.microsoft.com/Profile/de-DE/?user=wg1989johnCannot input Chinese in the Textbox of PopupHi<br/>I'm a college student in China.The teacher ask us to program with the WPF.<br/>Now,I use the a popup in a window,I have successfully created a textbox. I can input English and get them.<br/>But,I can not change the input method so that I cannot input Chinese.<br/><br/>And,I try creating a textbox just in a window,not in a popup.<br/>I can change the input method and input Chinese in the textbox just in a window.<br/><br/>I don't konw where the problem is ?  Is there anyone can help me? Thanks a lot.Sat, 28 Nov 2009 10:50:33 Z2009-11-28T10:50:34Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/c351f7f6-6968-422c-9e92-5bb9f3525e67http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/c351f7f6-6968-422c-9e92-5bb9f3525e67hermitOCYhttp://social.msdn.microsoft.com/Profile/de-DE/?user=hermitOCYCompilation Error Related to FIPS EncryptionHi,<br/> <br/> I am new to Silverlight development. When I was compiling a Silverlight application via Visual Web Developer, I was greeted with the following compilation errors which I have no idea how to resolve it. I tried to compile a &quot;blank&quot; Silverlight application which nothing was created, but still this error occurs. My machine is running .NET framework 3.5 sp1 and FIPS validated cryptographic algorithms has already been activated via machine policy.<br/> <br/> Any help is very much appreciated. Many thanks :)<br/> <br/> <br/> <br/> Error    1    This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.    F:\NET Projects\SilverlightApplication3\SilverlightApplication3\App.xaml    1    1    SilverlightApplication3<br/> <br/> Error    2    This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.    F:\NET Projects\SilverlightApplication3\SilverlightApplication3\Page.xaml    1    1    SilverlightApplication3<br/> <br/>Fri, 27 Nov 2009 11:00:41 Z2009-11-28T10:37:41Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/b8786341-379c-44f9-b7a8-3a315343ad73http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/b8786341-379c-44f9-b7a8-3a315343ad73suchit_geekhttp://social.msdn.microsoft.com/Profile/de-DE/?user=suchit_geekHow to add EventAggregator Support in MVVMHi,<br/><br/>I am using MVVM approach in Prism framework, how can I attach my view model to my view in Prism??? Whenever I try to use unityContainer.RegisterType&lt;&gt;() I don't see the viewmodel getting attached to my view and hence I don't get any eventAggregator instance coming in my VM too :-( <br/><br/>Could anyone guide me....<br/><br/>Thanks <hr class="sig">Computer GeekSat, 28 Nov 2009 03:37:20 Z2009-11-28T10:25:45Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/ac969dfb-acab-4932-b456-6276d536cff0http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/ac969dfb-acab-4932-b456-6276d536cff0Alexwpfhttp://social.msdn.microsoft.com/Profile/de-DE/?user=AlexwpfInkCanvas set/get ZIndexHello,<br/> <br/> I would like to change ZIndex to force display overlaps InkCanvas child elements on top.<br/> I can not find any method to set/get this property for InkCanvas? <br/> <br/> Best regards,<br/>Thu, 26 Nov 2009 03:30:27 Z2009-11-28T09:20:36Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/f125c86f-41a9-48a0-97a3-f577ff1391b5http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/f125c86f-41a9-48a0-97a3-f577ff1391b5Zach_Shinehttp://social.msdn.microsoft.com/Profile/de-DE/?user=Zach_ShineHow to reduce unnecessary elements in the Visual Tree? (Calendar contains over 480 elements!)Hi, <br/><br/>I just use Snoop to have a look at my simple WPF app. The surprising thing is that here are over 3000 elements in the Visual Tree!<br/>- I use the Calendar control in the WPF toolkit. One instance of it contains over 480 elements!<br/>- I use a ListBox and a DataTemplate for each item. There are about 10 levels in the Visual Tree between the ListBox to the root element of the DataTemplate. The path : ListBox-&gt;Border-&gt;ScrollViewer-&gt;Grid-&gt;ScrollContentPresenter-&gt;ItemsPresenter-&gt;ListBoxItem-&gt;Border-&gt;ContentPresenter-&gt;Grid(The root of the DataTemplate)<br/>- TextBox control creates many elements depending on the lines of your text!<br/><br/><br/>Maybe it's why WPF is so slow and uses so many memory?<br/>How can I reduce those unnecessary elements in the Visual Tree, such as those borders and presenters?<br/><br/>Best regards,<br/>Zach_ShineFri, 27 Nov 2009 09:47:58 Z2009-11-28T09:15:11Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/00b13b61-8e54-4078-94e8-1825d5954005http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/00b13b61-8e54-4078-94e8-1825d5954005handsomecelestehttp://social.msdn.microsoft.com/Profile/de-DE/?user=handsomecelesteHow to recognize the flick direction via StylusSystemGesture?<p>Hi all, I'm using the Windows7.Multitouch.Manipulation to handler the gesture, to zoom, translate, ro rotate the picture, it works well, but I also want the flick gesture, code like this:<br/><br/>StylusSystemGesture += new StylusSystemGestureEventHandler(Window1_StylusSystemGesture);</p> <p>        void Window1_StylusSystemGesture(object sender, StylusSystemGestureEventArgs e)<br/>        {  <br/>            switch (e.SystemGesture)<br/>            {<br/>                case SystemGesture.Flick<br/>                    // Do something.<br/>                    break;<br/>            }</p> <p>        }<br/><br/>in the SystemGesture have a enum value 'Flick', but no direction for it, so how can I know it to implement the 'Back' or 'Forward' ?</p>Sat, 28 Nov 2009 08:10:10 Z2009-11-28T11:00:14Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/fc9fd709-34f5-482f-931b-ab5e7e99ba03http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/fc9fd709-34f5-482f-931b-ab5e7e99ba03B. Clay Shannonhttp://social.msdn.microsoft.com/Profile/de-DE/?user=B.%20Clay%20ShannonTutorial on using the DataGrid with queries?<p>Can somebody point me to a tutorial on how to use a DataGrid to display the results of dynamic queries? I did find the following code (which uses a bogus (dynamically created, populated with constants) table example), but I don't know if I should modify this to accommodate the queries I want to create and execute, or go in an entirely different direction - any suggestions?<br/><br/>IOW, how would this need to be different for dynamic queries?<br/><br/>xaml:</p> <p><strong>        &lt;StackPanel&gt;<br/> . . .<br/>            &lt;DataGrid<br/>            ItemsSource=&quot;{Binding Path=.}&quot;    <br/>                         Margin=&quot;10&quot;  <br/>                         x:Name=&quot;_dataGrid&quot;    <br/>                         ColumnHeaderHeight=&quot;30&quot; AutoGenerateColumns=&quot;True&quot;    <br/>                             AlternatingRowBackground=&quot;Cyan&quot; CanUserSortColumns=&quot;False&quot;&gt;<br/>            &lt;/DataGrid&gt;<br/>        &lt;/StackPanel&gt;</strong></p> <p>code-behind:</p> <p><strong>private DataSet _ds;</strong></p> <p><strong>. . .</strong></p> <p><strong>protected override void OnInitialized( EventArgs e )<br/>    {<br/>      base.OnInitialized(e);<br/>      _ds = new DataSet();<br/>      DataTable table = new DataTable();<br/>      _ds.Tables.Add(table);</strong></p> <p><strong>      DataColumn col = new DataColumn(&quot;Name&quot;, typeof(string));<br/>      col.MaxLength = 100;<br/>      table.Columns.Add(col);</strong></p> <p><strong>      col = new DataColumn(&quot;City&quot;, typeof(string));<br/>      col.MaxLength = 100;<br/>      table.Columns.Add(col);</strong></p> <p><strong>      DataRow row = table.NewRow();<br/>      table.Rows.Add(row);<br/>      row[&quot;Name&quot;] = &quot;Norbert&quot;;<br/>      row[&quot;City&quot;] = &quot;Cologne&quot;;</strong></p> <p><strong>      row = table.NewRow();<br/>      table.Rows.Add(row);<br/>      row[&quot;Name&quot;] = &quot;Bob&quot;;<br/>      row[&quot;City&quot;] = &quot;London&quot;;</strong></p> <p><strong>      _dataGrid.DataContext = _ds.Tables[0];<br/>    }</strong>   <br/><br/></p><hr class="sig">Writer / Photographer: www.lulu.com/blackbirdcraven, www.bclayshannon.photoshop.comFri, 27 Nov 2009 20:52:32 Z2009-11-28T07:27:54Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/2691406e-c1ed-40af-b364-89fd9e76c824http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/2691406e-c1ed-40af-b364-89fd9e76c824B. Clay Shannonhttp://social.msdn.microsoft.com/Profile/de-DE/?user=B.%20Clay%20ShannonWhy is the designer blank?My project runs, and it shows its face at runtime, but at design time, it's blank (no GUI). Why is that? Here is my xaml:<br/><br/><span style="font-family:Consolas;color:#0000ff;font-size:small"><span style="font-family:Consolas;color:#0000ff;font-size:small"><span style="font-family:Consolas;color:#0000ff;font-size:small"><font face=Consolas size=3 color="#0000ff"><font face=Consolas size=3 color="#0000ff"><font face=Consolas size=3 color="#0000ff"> <p>&lt;Window x:Class=&quot;MC_Proctor.MainWindow&quot;<br/>        xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;<br/>        xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br/>        Title=&quot;MC Proctor&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;<br/>    &lt;Grid&gt;<br/>        &lt;StackPanel&gt;<br/>            &lt;Expander Margin=&quot;5&quot; Padding=&quot;5&quot; Header=&quot;Received Messages&quot; &gt;<br/>                &lt;ScrollViewer Height=&quot;50&quot; &gt;<br/>                    &lt;ListView Name=&quot;lvMsgs&quot; &gt;<br/>                    &lt;/ListView&gt;<br/>                &lt;/ScrollViewer&gt;<br/>            &lt;/Expander&gt;<br/>            &lt;DataGrid<br/>            ItemsSource=&quot;{Binding Path=.}&quot;    <br/>                         Margin=&quot;10&quot;  <br/>                         x:Name=&quot;_dataGrid&quot;    <br/>                         ColumnHeaderHeight=&quot;30&quot; AutoGenerateColumns=&quot;True&quot;    <br/>                             AlternatingRowBackground=&quot;Cyan&quot; CanUserSortColumns=&quot;False&quot;&gt;<br/>            &lt;/DataGrid&gt;<br/>            &lt;Button&gt;Show Highest Scores&lt;/Button&gt;<br/>        &lt;/StackPanel&gt;<br/>    &lt;/Grid&gt;<br/>&lt;/Window&gt;</p> </font></font></font></span><font face=Consolas size=3 color="#0000ff"><font face=Consolas size=3 color="#0000ff"> <p> </p> </font></font></span><font face=Consolas size=3 color="#0000ff"> <p> </p> </font></span> <p><span style="font-family:Consolas;color:#0000ff;font-size:small"><span style="font-family:Consolas;color:#0000ff;font-size:small"></span></span></p><hr class="sig">Writer / Photographer: www.lulu.com/blackbirdcraven, www.bclayshannon.photoshop.comFri, 27 Nov 2009 21:28:02 Z2009-11-28T07:19:19Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/9d8eceb3-122a-4367-ba21-03ee9ceacac5http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/9d8eceb3-122a-4367-ba21-03ee9ceacac5Nolan G.http://social.msdn.microsoft.com/Profile/de-DE/?user=Nolan%20G.Data Binding Dynamic List to Radio ButtonsI'm following the example here (<a href="http://forums.msdn.microsoft.com/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886#radiobuttonlist">http://forums.msdn.microsoft.com/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886#radiobuttonlist</a> ) to implement a list of radio buttons. My goal is have the number of radio buttons to be editable at runtime. I have modified the example to include a ComboBox used to select the number of radio buttons. I have also added a ViewModel for the window to hold the list that represents the radio buttons.<br/> <br/> This works fine if I use the ComboBox to decrease the number of radio buttons but if I add more radio buttons, the added radio buttons are not mutually exclusive (e.g. in my code below I start with four radio buttons and selection is mutually exclusive, if I change the ComboBox to eight, only the first five radio buttons are mutually exclusive, the remaining three radio buttons are not mutually exclusive)<br/> <br/> Any suggestions to why this is happening and how to fix it would be very helpful. <br/> <br/> XAML Code: <br/> <br/> <pre lang=x-xml>&lt;Window x:Class=&quot;ScratchWpf.Window1&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; xmlns:s=&quot;clr-namespace:System;assembly=mscorlib&quot; Title=&quot;Window1&quot; Height=&quot;300&quot; Width=&quot;300&quot;&gt; &lt;StackPanel&gt; &lt;ListBox ItemsSource=&quot;{Binding Choices}&quot; IsSynchronizedWithCurrentItem=&quot;True&quot;&gt; &lt;ListBox.ItemContainerStyle&gt; &lt;Style TargetType=&quot;{x:Type ListBoxItem}&quot;&gt; &lt;Setter Property=&quot;Template&quot;&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType=&quot;{x:Type ListBoxItem}&quot;&gt; &lt;RadioButton IsChecked=&quot;{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}}&quot; Content=&quot;{TemplateBinding Content}&quot;/&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/ListBox.ItemContainerStyle&gt; &lt;/ListBox&gt; &lt;ComboBox ItemsSource=&quot;{Binding NumberOfChoices}&quot; SelectedValue=&quot;{Binding ChoiceCount}&quot;/&gt; &lt;/StackPanel&gt; &lt;/Window&gt;</pre> <br/> C# View Model:<br/> <br/> <pre lang="x-c#"> class WindowViewModel { private static readonly int MaxNumberOfChoices = 26; private ObservableCollection&lt;string&gt; _choices; private List&lt;int&gt; _numberOfChoices = null; private int _choiceCount = 4; public ObservableCollection&lt;string&gt; Choices { get { if (this._choices == null) { this._choices = new ObservableCollection&lt;string&gt;() { { &quot;One&quot; }, { &quot;Two&quot; }, { &quot;Three&quot; }, { &quot;Four&quot; } }; } return this._choices; } } public List&lt;int&gt; NumberOfChoices { get { if (this._numberOfChoices == null) { this._numberOfChoices = new List&lt;int&gt;(WindowViewModel.MaxNumberOfChoices); for (int i = 1; i &lt;= WindowViewModel.MaxNumberOfChoices; i++) { this._numberOfChoices.Add(i); } } return this._numberOfChoices; } } public int ChoiceCount { get { return this._choiceCount; } set { this._choiceCount = value; this.ChangeChoiceCount(value); } } public void ChangeChoiceCount(int count) { if (count &lt; this._choices.Count) { for (int i = (this._choices.Count - 1); i &gt;= count; i--) { this._choices.RemoveAt(i); } } else { for (int i = this._choices.Count; i &lt; count; i++) { this._choices.Add(&quot;&quot;); } } } }</pre> <br/> <br/> <br/> <br/> <br/> <br/> <br/>Fri, 27 Nov 2009 23:56:02 Z2009-11-28T07:07:04Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/7cac7203-d703-483f-8145-464739cd7cd3http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/7cac7203-d703-483f-8145-464739cd7cd3mailzyokhttp://social.msdn.microsoft.com/Profile/de-DE/?user=mailzyokWPF application build by VS2008 C# (.Net 3.5), but the target framework is .Net 3.0 by configure the project property<p>I have build an APP using VS2008 c# (requires .Net 3.5 SP1), but the target .net framework is set to .Net3.0 in the project property. When run the app, there will be crash always, and after check the log, the Main window is initialized successfully, but crash before displayed<br/><br/>Environment:<br/><br/>1. XP SP2<br/>2. .Net 3.0<br/><br/><br/>App.xaml<br/><br/>&lt;Application x:Class=&quot;MyApp.App&quot;<br/>    xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;<br/> xmlns:System=&quot;clr-namespace:System;assembly=mscorlib&quot; <br/>    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br/>    StartupUri=&quot;MainWindow.xaml&quot;&gt;<br/><br/>...<br/><br/>Add log in the construct fuction in MainWindow.xaml.cs<br/><br/> public MainWindow()<br/> {<br/><br/>InitializeComponent();<br/>//log<br/>}<br/><br/>the log is printed out, which means  initializeComponent() is successful, but the our applications crash.<br/><br/>EventType : clr20r3     P1 : bcs.exe     P2 : 2.0.0.0     P3 : 4b0f87b0     <br/>P4 : presentationframework     P5 : 3.0.0.0     P6 : 45398c20     P7 : 6496<br/>P8 : be     P9 : system.windows.markup.xamlparse<br/><br/><br/>Pls help. Thanks in advance.</p>Fri, 27 Nov 2009 09:18:15 Z2009-11-28T05:14:42Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/fb0745f0-6c26-4a9e-b792-3f7e8484b243http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/fb0745f0-6c26-4a9e-b792-3f7e8484b243alainkkkhttp://social.msdn.microsoft.com/Profile/de-DE/?user=alainkkkallow only number in textbox<font face=Arial size=2> <p>hi .. how do i allow only user to key in number in the textbox.. </p> <p align=left>when they try to key in character.. they cant..  how i do that</p> <p align=left>thanks</p></font>Tue, 19 Feb 2008 13:15:11 Z2009-11-28T04:09:01Zhttp://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/b0f77818-dcd9-4922-b525-77ccaf333181http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/b0f77818-dcd9-4922-b525-77ccaf333181StevenIBhttp://social.msdn.microsoft.com/Profile/de-DE/?user=StevenIBconcurrency violation the deletecommand affected 0 of the expected 1 records.for C# using WPF dataset to sqlHello,<br/><br/>sorry for the long Title, but as said i am getting error message: concurrency violation the deletecommand affected 0 of the expected 1 records., this happens when i go and add a new/ or insert new to sql database using Dataset/dataadaptor, I am using WPF as for the Gui interface and using C# for the backend programming, here is the code right now i got that error's out on sqlda.Update(sqlds, &quot;Workers&quot;); and i seen there are ways of fixing this but i only seen it fixed for VB and sadly i dont know VB to well. so if anyone can let me know how to fix in C# that would be awesome, here is the code below of the delete event:<br/><br/> <pre> private void btn_delete_Click(object sender, RoutedEventArgs e) { if (Listview1.SelectedItems.Count &gt; 0) { if (MessageBox.Show(&quot;Are you sure you want to delete &quot; + (Listview1.SelectedItem as DataRowView)[&quot;First_Name&quot;].ToString() + &quot; &quot; +(Listview1.SelectedItem as DataRowView)[&quot;Last_Name&quot;].ToString(), &quot;Are you sure?&quot;, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { SqlCommandBuilder sq = new SqlCommandBuilder(sqlda); sqlds.Tables[&quot;Workers&quot;].Rows[Listview1.SelectedIndex].Delete(); MessageBox.Show(&quot;Record Deleted Successfully&quot;); //sqlds.AcceptChanges(); sqlda.Update(sqlds, &quot;Workers&quot;); } } else MessageBox.Show(&quot;Please select then click on delete button&quot;); }</pre> Thank youTue, 24 Nov 2009 00:10:23 Z2009-11-28T02:58:17Z