wpf-controls

How to set Z-index of calender control in wpf

点点圈 提交于 2019-12-11 19:25:22
问题 Here i am stuck in wpf calender control.I am using a calender control in WPF but when i call it on GotFocus event of TextBox like private void txtjobdate_GotFocus(object sender, RoutedEventArgs e) { calendar1.Visibility = Visibility.Visible; } It always show behind the other controls like xaml code <Window x:Class="PhotoSaver.PhotoGraphyJob_Management.AddEditPhotoGraphyJob" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

WPF RibbonButton: LargeImageSource and Label not updated via DataTriggers

安稳与你 提交于 2019-12-11 18:51:49
问题 I'm puzzled by a peculiar phenomenon in RibbonButton's behavior. Everything works fine when I set the LargeImageSource and the Label statically in XAML: <ribbon:RibbonButton x:Name="ButtonArchive" LargeImageSource="..\Assets\archive_insert.png" Label="{Binding Path=ItemArchiveButton, Source={StaticResource Strings}}"/> But when I try to modify these properties via DataTriggers - nothing seems to be happening. The triggers do work; I can see the other properties - like Command or IsEnabled -

Problem with WPF Stackpanel: how can I group elements in Circle?

不想你离开。 提交于 2019-12-11 18:28:03
问题 I have some controls in circle. I want to group them to add a common handler as seen here In WPF can I attach the same click handler to multiple buttons at once like I can in Javascript/Jquery? But if I use Stackpanel they won't be no more in circle so what alternative to stackpanel ? So is this impossible in WPF ? 回答1: If you are absolutely sure, that you want to use the same eventhadler for all the buttons, you can use the same trick described under the link you mentioned. Instead of

Reading text from multiple WPF textbox controls from a different thread

删除回忆录丶 提交于 2019-12-11 17:52:35
问题 In my WPF application I need to read text from several textboxes. Because the code is running in a different thread to the UI, I need to use Dispatcher.invoke() . At the moment I’m working with one textbox which works fine, but now I need all the texts. Do I need to write a Dispatcher.invoke for each textbox or is there a way to write a function so I pass in a textbox control reference and it returns the text? 回答1: You could just grab the text from all the TextBox fields in the same Invoke

How to override application styles in a wpf control created at runtime

半腔热情 提交于 2019-12-11 16:55:45
问题 I am trying to create a WPF control at runtime, but I can't figure out how to make it ignore the styles coming from the App.xml resources. I've tried setting the style to null and the OverridesDefaultStyle to true but no luck. The app settings set the foreground to white, and I can't seem to explicity set it to anything else. Label tb = new Label(); tb.OverridesDefaultStyle = true; tb.Style = null; tb.Foreground = new SolidColorBrush(Colors.Black); this.Children.Add(tb); Edit: For some reason

Altering a ControlTemplate from code behind

▼魔方 西西 提交于 2019-12-11 13:56:00
问题 Application: Hello, I am dynamically adding custom controls to a WPF application. The control is a custom slider. I have created a ControlTemplate in the XAML file which I want to use as the template for these dynamically created controls. I am currently applying the template by using: newControl.Template = (ControlTemplate)parent.Resources["nameOfTheControlTemplate"]; This currently works OK (i.e. compiles, runs, and applys the template). The template looks like this: ( Sorry for wall of

.NET BarCode Reader in WPF

怎甘沉沦 提交于 2019-12-11 13:45:14
问题 I am trying to see whether its possible to read the barcode in WPF Applications without using any 3rd party tools. We built an application using WPF and they are not willing to buy any third party devices to read the barcode. Is there any other way to read the barcode data in WPF Applications using .NET APIS? Note: I seen examples in .NET, but most of them using Barcode reader tool. I have seen examples in Android ZXing library does that with out any tools like barcode reader or scanner. Any

Unregister Message in Destructor make error ({“Handle is not initialized.”})

浪子不回头ぞ 提交于 2019-12-11 13:44:00
问题 Is there anyone who experienced the same error like me: Situation: - I'm using MVVMLight v4 with my window application: - I have a windows form : such as mainform - In code-behind class (mainform.xaml.cs), I have a constructor & a deconstructor: public mainform() { Messenger.Default.Register<NotificationMessage>( this, msg => { //// Do something } } ~mainform() { Messenger.Default.Unregister<NotificationMessage>(this); } Those code run well, but when the form is closed, an exception will be

How to set Panel.Zindex value though XAML code if any of the Grid/UserControl children having the focus

橙三吉。 提交于 2019-12-11 13:17:37
问题 I think I have not explained correctly. So i have just edited the previous post. Please go through my exact requirement I have user control with a button. I have written code to enlarge the button if it gets focus through rendering in style. In my window, in the main grid i have placed 10 instances of this user control ( 1 control per cell, totally 2 rows and 5 columns). Now, if i keep the focus on the first user control button, it expands correctly as it gets focus and also user control

WPF Datagrid refresh Displaymember path empty

不羁岁月 提交于 2019-12-11 11:59:52
问题 I want to Refresh my DataGrid and found the following coding on the web: dataGridView.ItemsSource = null; dataGridView.ItemsSource = ItemsSourceObjects; It does work except for the string/column Names does not get displayed with the objects only the objects/items itself. Any Ideas on why this is happening? EDIT: <DataGridTextColumn Binding="{Binding TId}" Header="id" MinWidth="20" MaxWidth="60"/> <DataGridTextColumn Binding="{Binding TChassisManufacturer}" Header="Project Name" MinWidth="122"