Set current date WPF calendar
WPF -> Calendarcalendar.DisplayDate = new DateTime(2020, 4, 17);calendar.SelectedDate = new DateTime(2020, 4, 17);
View ArticleWPF Calendar SelectedDates
WPF->CalendarAdd multiple selected dates to WPF Calendar.<Grid> <Calendar x:Name="calendar" /></Grid>calendar.SelectionMode = CalendarSelectionMode.MultipleRange;...
View ArticleWPF TabControl Example
WPF -> Controls -> TabControl WPF TabControl elements display content on discrete pages accessed by selecting the appropriate tab.Example<Window x:Class="Agenda.MainWindow"...
View ArticleDatePicker WPF Example
System.Windows.Controls -> DatePickerRepresents a control that allows the user to select a date.Example<Window x:Class="WpfApp4.MainWindow"...
View ArticleDisplay XAML window in the second display WPF
WPF > Windows > Forms > ScreenAllScreens gets an array of all displays on the system.ExampleDisplay window in the second display WPFprivatevoid Window_Loaded(object sender, RoutedEventArgs e){...
View ArticleGridViewColumnHeader WPF Example
WPF > Controls > ContentControl > GridViewColumnHeaderGridViewColumnHeader object is a button control that is derived from ButtonBase. Column headers in a GridView view mode are...
View ArticleGet Vertical ScrollBar Width WPF
WPF > Windows > SystemParameters> VerticalScrollBarWidthThis value indicates the width (in pixels) of a vertical scroll bar.SystemParameters.VerticalScrollBarWidth
View ArticleBind Width to another Width control WPF
WPF > Binding > Width<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="{Binding ElementName=controlName, Path=ActualWidth}"/> </Grid.ColumnDefinitions>
View ArticleScrollToTop DataGrid WPF
WPF> DataGrid > Scroll To Topvar border = VisualTreeHelper.GetChild(myDataGrid, 0) asDecorator;if (border != null&& border.Child !=null){ var scrollViewer = border.Child asScrollViewer;...
View ArticleFrameworkElementFactory focus on load element
WPF > FrameworkElementFactory > AddHandlerFrameworkElementFactory textBox = newFrameworkElementFactory(typeof(TextBox));textBox.AddHandler(TextBox.LoadedEvent,...
View ArticleDisable row selection datagrid WPF
How to disable row selection in datagrid WPF?Answer:myDataGrid.IsHitTestVisible = false;
View ArticleFind TextBox control ComboBox WPF
WPF > Controls > ItemsControl > ComboBoxUse FindName to find an element that has the provided identifier name.PART_EditableTextBoxTextBoxContains the text of the ComboBoxExamplevar textBox =...
View ArticleSet DataGrid DataGridRow Background color WPF
WPF > DataGrid > DataGridRow > Background<DataGrid.RowStyle> <Style TargetType="DataGridRow"> <Style.Triggers> <DataTrigger Binding="{Binding IsValid}"...
View ArticleClear Sort WPF DataGrid
WPF > Controls > ItemsControl > DataGrid > Clear Sort_collectionView = (CollectionView)CollectionViewSource.GetDefaultView(dataGrid.Items);_collectionView.SortDescriptions.Clear();
View ArticleConvert Hex to SolidColorBrush
WPF > System.Windows.Media > BrushConverterBrushConverter is used to convert a Brush object to or from another object type.Example:row.Background =...
View ArticleGet Current Row WPF DataGrid
WPF > Controls > ItemsControl > DataGrid > ItemContainerGenerator > ContainerFromIndexReturns the element corresponding to the item at the given index.ExampleHow to get current row if...
View ArticleGet rectangles from canvas WPF code behind
WPF > Controls > Layout > Canvas > ChildrenExample Get all rectangles from canvas.privateList<Rectangle> GetRectangles(){ return...
View ArticleRound line WPF code behind
WPF > Line Line line = newLine{ Stroke = Brushes.Blue, StrokeThickness = 18, StrokeStartLineCap = PenLineCap.Round, StrokeEndLineCap = PenLineCap.Round, Height= 50, X1 = 50, X2 = 100, Y1 = 10, Y2 =...
View ArticleSlider WPF Example
WPF > Controls > Slider <Grid> <TextBox Text="{Binding ElementName=Slider, Path=Value, UpdateSourceTrigger=PropertyChanged}"...
View Article