|
If you did public class DatePickerEx : DatePicker, then you'll get all the public properties and methods of DatePicker. If that's not working, you did something wrong . Not sure what since you didn't post what errors you are getting or any code.
|
|
|
|
|
in my application WPF/C# , i have a simple TreeView "treview1" that content for exemple:
*item1
* item1.1
*item2
* item2.1
Now i have an Class "Search.cs", and within this Class i have some methods like: advanced_serch and simpl_search , I want to be able to modified my TreeView in this two methods(advanced_serch and simpl_search).....
How i can dos this???
Please help me !!
|
|
|
|
|
What do you expect your searches to do (other than find a node label)?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
for exemple, in my Advanced_Search i want to upadate My TreeView( delete or add items).
|
|
|
|
|
Mouaici Mohamed wrote: Advanced_Search i want to upadate My TreeView( delete or add items). That makes no sense, search implies finding something, not modifying the data.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am attempting to create a common WPF logon dialog. I have the dialog as a separate DLL which access a service and returns the user permissions. This works except the dialog displays as an independent window. I want to pass the main window to the dialog as the owner.
I call the logon dll from the main viewmodel
public void ShowLogon()
{
new IFALogon.LogonDlg().DoLogon(MainUI.AppID, "Finance NPA");
if (IFALogon.LogonVM.DBUser == null)
{
Exit();
}
else
{
}
}
How can I pass the main view to this DLL.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In a WPF application, you have global access to the main window through the static Application.Current.MainWindow.
|
|
|
|
|
That did the trick, I now have a DLL that can be used to authenticate and authorise all our WPF apps. Thank you!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a Treeview (telerik) using HierarchicalDataTemplate
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
<Border Background="{Binding BackColour}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImageSource,Converter={StaticResource ImageFromAssetsConverter}}"
Width="16"
Height="16" />
<TextBlock Margin="10,0"
Text="{Binding NodeLabel}"
TextWrapping="Wrap"
VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding IsChecked,Mode=TwoWay}"
Content="Default N/A" Margin="15,0,0,0"
Visibility="{Binding ShowCheckBox,Converter={StaticResource VisibilityConverter}}" />
</StackPanel>
</Border>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
The user MUST select the node BEFORE checking the checkbox. Is it possible to select the node when the user checks the checkbox.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes. Add a trigger to the TreeViewItem that says if IsKeyboardFocusWithin is true, then select the item.
|
|
|
|
|
yes pass a event treeviewitem
|
|
|
|
|
Thank you that was enough to chase down the detail.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The trick was to add an ItemContainerStyle because I am using a HeirarchicalDataTemplate
<telerik:RadTreeView.ItemContainerStyle>
<Style TargetType="{x:Type telerik:RadTreeViewItem}">
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="true">
<Setter Property="IsSelected" Value="true" />
</Trigger>
</Style.Triggers>
</Style>
</telerik:RadTreeView.ItemContainerStyle>
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi, I am looking for ideas. Have to create controls dynamically and store values of textbox, combobox in database. Suppose I will give number 5 in existing textbox then it should create 5 textboxes and 5 combobox dynamically, all values of controls also have to save. Please share yours ideas. Thanks
|
|
|
|
|
|
Good tutorial, but my thing is have to create controls and take input from dynamically created controls.
|
|
|
|
|
You really need to provide a lot more detail about what problems you are having in implementing this.
|
|
|
|
|
foreach (TabItem ti in MainWindow.mw.tcMain.Items)
{
if (Convert.ToInt16(ti.Tag) == r.id)
{
MainWindow.mw.tcMain.SelectedItem = ti;
return;
}
}
|
|
|
|
|
That code selects the TabItem whose Tag is an int16 value that matches r.id.
The Tag property is present in many controls and is a custom user value not used by Wpf. You can use it to store an object of your choice and perform your custom logic based on it, for example save the original id such as in this code
|
|
|
|
|
|
Hi!
I have read along with this article [^]regarding WPF applications with Markup extensions.
In the end of the article there is the section called Custom Markup Extension example which I have tried and got working. The XAML code for the example confuse me.
In the articles C# code there is the ReflectionExtension class
public class ReflectionExtension : MarkupExtension
{
...
}
But in the XAML code there is no reference to ReflectionExtension instead there is a refence to Reflection.
<ListBox ItemsSource="{local:Reflection {x:Type Grid},
IncludeMethods=true, IncludeFields=true, IncludeEvents=true}"
MaxHeight="200" Grid.Row="3" Grid.ColumnSpan="2" />
I cannot find any reference what so ever in the article for Reflection, but somehow the example manage to reference to ReflectionExtension, compile and run.
If I rename the ReflectionExtension to MagicClass I must re-build the entire solution and change the XAML to:
<ListBox ItemsSource="{local:MagicClass{x:Type Grid},
IncludeMethods=true, IncludeFields=true, IncludeEvents=true}"
MaxHeight="200" Grid.Row="3" Grid.ColumnSpan="2" />
...or else the solution will not compile.
Is there a simple explanation for this?
I also have a further question regarding Markup Extensions.
In my company we have a language project which have classes deriving the MarkupExtension class. This gives the possibility in design time of XAML to
show different language text for buttons, labels and whatever other UIElement control that can display a text. The interesting is that I can switch language while in design-time and the XAML automatically display the selected language's text.
Unfortunately I cannot give away a example of this source code and might give me an explain how this works, but the XAML code I use is this:
<Button Content="{l:Lang Key=20}" \>
The "l" is the namespace reference xmlns:l="clr-namespace:namespace;assembly=assembly".
The "lang" must be a reference to a class deriving the MarkupExtension class. But I have search in the entire project for "lang" and cannot find ANY reference to it what so ever.
The "Key=20" is a reference to a the current language file with indices. In the my example there must be an index with value 20 which contain some text for whatever language is selected.
Without having the source code, can someone explain this?
Best regards,
/Steffe
|
|
|
|
|
Steffe - MarkupExtensions apply a little bit of magic here. If you add Extension to the end of your MarkupExtension class, you can leave this out of your XAML and the compiler will pick up which one you're trying to use.
As to your other question, is there a class called LangExtension in there by any chance?
|
|
|
|
|
Thanks for the reply Pete!
I will check that tomorrow if some class is named "LangExtension". I know there are two classes deriving the MarkupExtension class, so one of the must it be.
Another question: Is the MarkupExtension class meant to execute XAML code in design-time as well as runtime? The example I give with language project, in my original post, gives me a HUGE advantage when creating GUIs.
I have tried to understand the documentation of Markup extension on MSDN[^] but it is to big to scope, to generalized explaination and no obvious super easy example
Any suggestion of source which I can study?
/Steffe
|
|
|
|
|
Mc_Topaz wrote: Another question: Is the MarkupExtension class meant to execute XAML code in design-time as well as runtime? Well, that's the thing. Basically, in order to render a view of your UI in the designer, your code is periodically compiled and a new "snapshot" instance of the UI is rendered into place. This means that you get a version of a running app displayed, so it renders a design time view that just happens to have been created from a runtime version. So yes, your MarkupExtension will run.
Ooh, a simple MarkupExtension. Now, that's a thing. The good Dr WPF has some great examples here[^] that might shed some light for you.
However, a point for you to ponder - the use of {...} in XAML indicates that there's a MarkupExtension in there. So, whenever you see Binding, StaticResource, DynamicResource, etc, these are all markup extensions - indeed, if you were to look in the Object Browser, you would see they all have Extension after them - so it's BindingExtension, etc.
|
|
|
|
|
Pete O'Hanlon wrote: so it's BindingExtension, etc.
Actually, Binding is one of the ones that doesn't have the ...Extension suffix.
The *Extension naming pattern is for convenience and consistency. It is not necessary in order for a XAML processor to identify that class as support for a markup extension. So long as your codebase includes System.Xaml and uses .NET Framework XAML Services implementations, all that is necessary to be recognized as a XAML markup extension is to derive from MarkupExtension and to support a construction syntax.
WPF defines markup extension-enabling classes that do not follow the *Extension naming pattern, for example Binding . Typically the reason for this is that the class supports scenarios beyond pure markup extension support. In the case of Binding , that class supports run-time access to methods and properties of the object for scenarios that have nothing to do with XAML.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|