|
I would really get some books. They are a big help (as long as they are the right ones).
|
|
|
|
|
In the code of a WPF custom control, I am updating Property1 in the Set{}
of another Property2(i.e. when another property changes). the Property1 is updated properly, but the updated value is not diaplayed in the Property Dialog Box of Visual studio. How can I get the updated value diaplyed in Property dialog box.
<br />
public string ControlID<br />
{<br />
get<br />
{<br />
return controlid;<br />
}<br />
set<br />
{<br />
controlid = value;<br />
Propertytoupdate = value;
<br />
}<br />
}<br />
|
|
|
|
|
One thing you need to do is implement INotifyPropertyChanged, and have the change notification raised when the property changes.
|
|
|
|
|
help to create a seprate dlls ?
|
|
|
|
|
|
Each project you add to your solution will compile into an assembly.
If you add a project of Type: Class library, WPF User Control Library or WPF Custom Control Library, these will all compile into their own .dll.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
|
Pleasure. Glad you like it.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hello All,
Is there any way to bind TreeView with nested object without using HierarchicalDatatemplate?
For example:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<TreeView Margin="10,10,46,52" Name="familyTreeView"
/>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1 {
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window {
public Window1() {
InitializeComponent();
List<Person> _family = new List<Person>();
Person mom = new Person() { Name = "Hteik Tin May" };
mom.Children.Add(new Person() { Name = "Michael Sync" });
mom.Children.Add(new Person() { Name = "Shwesin Sync" });
mom.Children.Add(new Person() { Name = "Aye Nyein Thu" });
mom.Children.Add(new Person() { Name = "Kyaw Zin Thu" });
_family.Add(mom);
familyTreeView.ItemsSource = _family;
familyTreeView.DisplayMemberPath = "Name";
}
}
public class Person {
readonly List<Person> _children = new List<Person>();
public IList<Person> Children {
get {
return _children;
}
}
public string Name { get; set; }
}
}
It's not working without HierarchicalDatatemplate.
Any idea?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
|
|
|
|
|
Any specific reason you don't want to use this HierarchicalDataTemplate?
You can always add TreeViewItems manually.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I want to depend on the structure of my object. not Hierachical DataTemplate which is static.
or Am I missing something?
What should I do if I want to change the level of treeview? For example: 2 level Hierachical structure to 5 level Hierachical
2 level Hierachical structure
-111
---22222
---22222
-333
---44444
---44444
5 level Hierachical structure
-111
---22222
--------333333333333
-------------44444444444
-------------------------55555
---22222
-333
---44444
---44444
|
|
|
|
|
|
Hi
I just need to ask a quick question where do I insert my xml data into my wpf application. Like when the user clicks a button it should display for example (a dialog, picture, play a sound, ect.)
Thanks
Andrew McIntyre
|
|
|
|
|
Andrew,
Can you provide a few more details so we can lend you a hand.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi everyone,
i am trying to export listview data to xps using c#.net3.5, wpf. is it possible to export to xps? if it is possible means give me some samples.
regards
Kanna
|
|
|
|
|
Hello sir even i'm trying to do that. If u get please let me know.,..
|
|
|
|
|
Hi All,
I'm having some trouble using some XAML and an attached property to vary a graphic in the UI. It seems to be intermittently working!! I was testing a Debug and Release version and all was working well but I've just fired it up again and its whacko!!
The XAML is:
<DataTrigger Binding="{Binding Path=(local:TreeViewItemProps.IsRootLevel),
RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}, Mode=FindAncestor}}" Value="True">
<Setter TargetName="img" Property="Source" Value="/SampleSort.Modules.Browser;component/Graphics/diskdrive.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=(local:TreeViewItemProps.IsRootLevel),
RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}, Mode=FindAncestor}}" Value="False">
<Setter TargetName="img" Property="Source" Value="/SampleSort.Modules.Browser;component/Graphics/folder.png" />
</DataTrigger>
The error I get is:
Cannot convert string '/SampleSort.Modules.Browser;component/Graphics/diskdrive.png' in attribute 'Source' to object of type 'System.Windows.Media.ImageSource'. Cannot locate resource 'graphics/diskdrive.png'.
I don't get why its randomly stopped working. I haven't touch *any* code since working on this app yesterday!
|
|
|
|
|
Jammer,
If you're testing a Boolean value, then you only need one trigger and not two. Assign one of the images as the default and trigger on the other value to swap.
If this drives you crazy and you can't get it to work, I've always just used a TemplateSelector to solve issues like this.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
That makes complete sense <slaps forehead>, i'll just pop off and fix this.
|
|
|
|
|
Hello everyone,
In Design-Time we can add a (for example) button into a ListBox, something like this:
<ListBox Margin="120,34,0,49" Name="listBox1" HorizontalAlignment="Left" Width="147">
<ListBoxItem>
<Button Width="141">I'm a ListBox Item!</Button>
</ListBoxItem>
</ListBox>
My question is can we Dynamically declare a ListBoxItem like this?
Thanks.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Without any doubt.
XAML is just markup that creates instances of objects and sets their properties.
Ex: listBox1.Items.Add(New Button)
In WPF, any control that has a Context property, you can basically put anything you want it in and it will be happy.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thank you very very much
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Hi,
I am developing WPF custom controls.
Is there a way to get notification when a property value in changed by
the Visual studio IDE xaml Editor ( not through the Property dialog).
I need the notification in custom control class
|
|
|
|
|