[Solved] WPF Dependency guide [closed]

[ad_1] What is Dependency Dependency means an object depending upon another object. An object O1 depends upon another object O2 when O1 is using O2’s property to do some changes in its own(O1) property. Why we need it To achieve these changes, some notification logic is needed of-course. Before WPF or similar technology, we were … Read more

[Solved] How i can use wcf in a wpf application [closed]

[ad_1] WPF is a computer-software graphical subsystem for rendering user interfaces in Windows-based application. WCF is a set of APIs in the .NET Framework for building connected, service-oriented applications. There is a cool blog post about how you can implement a WCF service and then consume it using a WPF client. 2 [ad_2] solved How … Read more

[Solved] WPF C# Bind multiple treeViewItems isSelected to tabItem isSelected

[ad_1] using SelectedValue and SelectedValuePath. The TreeViewItem child and parent must have the same Uid. <Window x:Class=”WpfApp1.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”> <StackPanel> <TreeView x:Name=”treeView” Height=”200″ SelectedValuePath=”Uid”> <TreeViewItem Header=”Letters-1″ x:Name=”tab1″ Uid=”Letters-1″> <TreeViewItem Header=”a” Uid=”Letters-1″/> <TreeViewItem Header=”b” Uid=”Letters-1″/> <TreeViewItem Header=”c” Uid=”Letters-1″/> </TreeViewItem> <TreeViewItem Header=”Letters-2″ x:Name=”tab2″ Uid=”Letters-2″> <TreeViewItem Header=”d” Uid=”Letters-2″/> <TreeViewItem Header=”e” Uid=”Letters-2″/> <TreeViewItem Header=”f” Uid=”Letters-2″/> </TreeViewItem> <TreeViewItem Header=”Letters-3″ x:Name=”tab3″ … Read more

[Solved] How to bind List to a DependencyProperty

[ad_1] The Binding in the UserControl’s XAML should have the UserControl instance as its source object, e.g. like this: <ListView ItemsSource=”{Binding MessageList, RelativeSource={RelativeSource AncestorType=UserControl}}” /> Alternatively you could set x:Name on the UserControl and use an ElementName binding: <UserControl … x:Name=”self”> … <ListView ItemsSource=”{Binding MessageList, ElementName=self}” /> … </UserControl> Besides that you should usually not … Read more

[Solved] Why can’t I play an MP3 file from a separate object?

[ad_1] The code you are writing in the Offnen.cs file isn’t doing anything with the file because the variable “mp” is local to the object o (Offnen). Perhaps something like this is what you are looking for: MainWindow.xaml.cs #region Öffnen der Datei private void menuOffnen_Click(object sender, RoutedEventArgs e) { mp.Pause(); Offnen o = new Offnen(); … Read more

[Solved] Combobox show and hide ComboBox items in WPF

[ad_1] Create a custom control such as: public class CrazyCombo : ComboBox { static CrazyCombo() { DefaultStyleKeyProperty.OverrideMetadata(typeof(CrazyCombo), new FrameworkPropertyMetadata(typeof(CrazyCombo))); } public int InitialDisplayItem { get { return (int)GetValue(InitialDisplayItemProperty); } set { SetValue(InitialDisplayItemProperty, value); } } // Using a DependencyProperty as the backing store for InitialDisplayItem. This enables animation, styling, binding, etc… public static readonly DependencyProperty … Read more

[Solved] Get access to other classes [closed]

[ad_1] What are you trying to do looks dangerous to me. Try to understand what those classes are for and ask some advice from a colleague. He will definitely help you on that. You will not find an answer here because your situation is too specific and we have no sample code. Also, some OOP … Read more

[Solved] WPF binding to custom class with observable collection

[ad_1] It sounds like you haven’t assigned your DataContext. Below is a brief example. Assuming your custom class looks something like this: CODE: public class Foo { private ObservableCollection<string> _names; public ObservableCollection<string> Names { get{ return _names;} set { _names = value; } } } and your XAML looks like XAML: <ListBox Name=”lstNames” ItemsSource=”{Binding Names}”/> … Read more

[Solved] open new notepad.exe and write content to it [duplicate]

[ad_1] try this one source [DllImport(“user32.dll”, EntryPoint = “FindWindowEx”)] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport(“User32.dll”)] public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam); private void button1_Click(object sender, EventArgs e) { Process [] notepads=Process.GetProcessesByName(“notepad”); if(notepads.Length==0)return; if (notepads[0] != null) { IntPtr child= FindWindowEx(notepads[0].MainWindowHandle, new IntPtr(0), … Read more

[Solved] overriding ToString() method, behaves strange with Binding

[ad_1] <DataGridTextColumn Header=”Name” Binding=”{Binding Path=Name,Mode=TwoWay}” /> DataGridTextColumn takes a CellContent instance and calls ToString() to display it. It displays Value, but without .Value in the path edits in datagrid cells are not applied. <DataTrigger Binding=”{Binding IsTrend}” Value=”True” > DataTrigger takes a CellContent instance and calls Equals() with parameter “True”. But CellContent object is not equal … Read more

[Solved] Two combobox with same ItemsSource of ObservableCollection

[ad_1] ComboBoxItem is a FrameworkElement which cannot belong to multiple parents. When you use string collection, each ComboBox generate a new ComboBoxItem for the same string. When collection contains ComboBoxItems, comboBoxes don’t create other ComboBoxItems and reuse existing, stealing them from each other. Additionally when you follow MVVM approach, you should not have ComboBoxItem objects … Read more