xaml - wpf datagrid custom header reserves space when data is collapsed

I have a column with a custom header in my DataGrid. Part of the header needs to disappear when a user enables a CheckBox (named: show). I can see the text disappearing when I enable the CheckBox, but the width doesn't get adjusted, so they still reserve the space they used to.<telerik:GridViewDataColumn.Header> <StackPanel Orientation="Horizontal"> <TextBlock Text="Name" Margin="0,0,35,0" /> <TextBlock Text="Date" Margin="0,0,35,0" Visibility="{Binding Path=IsChecked,Source={x:Reference show}, Converter={S...Read more

wpf - itextsharp auto font size and Linebreak only on Spaces

I have a itextsharp Table, with a strict height and width of the Cells. I then get a string that can differ in word count and work length. How can i set the Font size automaticaly to go as big as possible, and only allow breaks after a word has ended, just like in WPF's Viewboxes.currently i am working with this:Cell.AddElement(new Paragraph(text, new Font(Font.FontFamily.COURIER, Convert.ToInt32(FZ), 1)){Alignment = Element.ALIGN_CENTER}); Cell.VerticalAlignment = Element.ALIGN_MIDDLE; Cell.HorizontalAlignment = Element.A...Read more

wpf - User Control with Viewbox - binding Path Data

I have a usercontrol that contains the following Xaml:<Viewbox Style="{StaticResource shapeViewboxStyle}"> <Canvas Width="32" Height="32" Margin="5"> <Path Data="{Binding Path=PathData}"/> </Canvas> </Viewbox>In the code-behind I expose a dependency property: public string PathData { get { return (string)GetValue(PathDataProperty); } set { SetValue(PathDataProperty, value); } } public static readonly DependencyProperty PathDataProperty = DependencyProperty.R...Read more

xaml - WPF MultiBinding Ellipse Fill

I am not able to get MultiBinding on Ellipse.Fill working correctly. I do have (single) Binding working correctly, plus MultiBinding on Ellipse.Tooltip:<Ellipse Margin="210,56,0,0" Fill="{Binding InspectorPC, Converter={StaticResource statusButtonConverter}, Mode=OneWay}"> <Ellipse.ToolTip> <MultiBinding Converter="{StaticResource statusStringConverter}" Mode="OneWay"> <Binding Path="InspectorPC"/> <Binding Path="InspectorPCPing"/> <Binding Path="InspectorPCReadHD"/>...Read more

wpf - Changing a linked list of Ellipses to images in c#

I've made a simple snake game in c# wpf forms.The problem is that Iv'e made the food as Ellipses and I want to change that to an image of an apple.This is the food class where I specified the type/shape of the food : using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Shapes;using System.Windows.Media;using System.Windows.Controls;namespace WpfApp1{class Food{ public double x, y; public Ellipse e = new Ellipse(); public Food(double x, double y) { ...Read more

wpf - Xceed DataGrid: Filtering Details

I've got a Master/Detail DataGrid and I want to filter the details. Here's my DataGridCollectionViewSource: <xcdg:DataGridCollectionViewSource x:Key="Features" Filter="ExampleFilter" Source="{Binding Path=ItemUnderEdit.Features}" AutoCreateDetailDescriptions="False" AutoCreateItemProperties="False"> <xcdg:DataGridCollectionViewSource.Detail...Read more

wpf - Why CEF browser exe count is not inceasing per browser?

When I open 1 cef browser, number of cef browser exe instance is 1.When I open 2 cef browser, number of cef browser exe instance is 2.When I open 3 cef browser, number of cef browser exe instance is 3.When I open more than 3 cef browsers, number of cef browser exe instance is still 3.Why is this behavior? I am using 53.1.0 version of Cef.WPF....Read more

wpf - What framework for MVVM should I use?

I am developing an application with the MVVM model, but I have reached a point where I need to choose which framework to use.Among the possible options are:MVVM Toolkit MVVM Foundation WPF Application Framework (WAF) Light MVVM Caliburn Cinch PrismIn your experience, which is better?...Read more

wpf - border that encapsulates textblocks

I am not sure if this is possible in wpf or not but, lets say I have multiple textblocks and other controls in a grid on a page<TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="1" FontSize="30" Text="Station" HorizontalAlignment="Left" Margin="65.2,0,0,3" VerticalAlignment="top" Width="104" Height="47" /> <ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="1" HorizontalAlignment="Left" Margin="50.2,2,0,0" VerticalAlignment="Bottom" Width="120" Height="22" /> <TextBlock Grid.Row="2" Grid.Column="4" Text="Date" ...Read more

wpf - laying out images in Word document programatically

I'm trying to generate word document through my application coded in WPF. In that document, I also need to layout few images along with caption as shown in the image below.All the images are stored in database as base64 string. I'm able to load the images as "BitmapImage" object in the document however not sure how to layout the images as shown in image. Code snippet to load the images in document is as below : var bookmarks = wordDoc.Bookmarks; var range = bookmarks["ExternalImage"].Range; foreach (var image in ExternalIma...Read more

wpf - MenuItem HorizontalAlignment not working

I have a menu inside the grid with on item:I want to change the horizontal and vertical alignment of this MenuItem to fit the entire grid cell. I wrote this: <Menu> <MenuItem Header="Hello" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> </Menu>But it stays as before: I even tried to change the HorizontalAlignment to Center and it's still the same. How do I accomplish this? Note: the menu itself is stretched by default - you can see that because of the background color. updateI need to support subItem...Read more

wpf - How to build a grid of controls in XAML?

I am trying to build a UI in WPF to a specification. The UI is for editing a collection of items. Each item has an editable string property, and also a variable number of read-only strings which the UI needs to display. It might look something like this:                                  or, depending on data, might have a different number of text label columns:                            &nbs...Read more

xaml - Resizing WPF Grid layout of labels and textboxes

I am new to WPF and had a few questions with regards to layout approach and resizing strategies. Here is a screenshot of a of a tab I put together laid out solely with a series of nested grids:Sample ImageThe first grid is 2 rows: 1 row autosized for a dockpanel of buttons at the top, and a 1* row for the rest of the space at the bottom, which is split with another grid dividing the bottom space into 3rds.I am happy with the way the layout looks here, but was wondering the best way to approach handling resizing. Currently, if I start sizing dow...Read more

xaml - WPF Datagrid flickering issue

In WPF, I have a DataGrid bound to a DataView in the ViewModel class. It is a touch panel embedded project, so every time I touch and slide my fingers on the panel it keeps sending me values and saves those values to the DataTable and assigns it to the bound DataView in a way where it can show only 5 or 10 rows (predefined) as the data gets updated. Every time I get a new row I delete the last till the total DataTable row count is 5/10. The issue here is that it is taking longer than usual for the DataGrid to bind to the last values. The moment...Read more