.net - Wpf Command Custom Control Binding Xaml?

Dec 15, 2009

i'm building a Videoplayer custom control (Project called WpfCustomControlLibrary1) and want to add a Load Command.This is what i have added in my class to get this Command:

Public Class VideoPlayer
Inherits Control
...
Public Shared ReadOnly LoadCommad As RoutedUICommand
....

[code].....

i get an error that he cant convert the string in the Attribute "Command" into an Object of the Type "System.Windows.Input.ICommand

View 2 Replies


ADVERTISEMENT

Referencing XAML Custom Control Names And Properties Within Code Behind?

May 13, 2009

I've created a Custom Control, and I will be placing a large number of instances of that Custom Control on my xaml page. In working with that Custom Control in the VB Code Behind, how do I do the following?

How do I reference the name of the Custom Control (in my VB code) which was clicked with the MouseLeftButtonDown event? For example, if I have 10 instances of my Custom Control in xaml, each with a different x:name (say 1-10), when a particular instance is clicked, how can I see which one was clicked? I've tried a number of things including e.OriginalSource.Name (which returns the component within the control which was clicked and not the name of the instance of the control). My Custom Control consists of numerous parts and pieces (Rectangles, Lines, Text, etc). Each of these items is a part of my layer. In VB code, once I can reference a particular Control, how can I hide or change certain parts of that control (such as hiding a Line, and changing the text). Also, I need to modify more than just the control which was clicked, so I need to be able to access properties of all of the controls, not just what was clicked. For example, if I click Control instance Test1, I also need to modify Test2, Test3, and Test5 in some way.

Here is some test code I through together as part of a Silverlight project using MS Blend 2. My control is much larger, and I need 200 - 250 instances/copies of that custom control, so I really need to know which control instance/copy was clicked.

My UserControl:

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

[Code].....

View 1 Replies

C# - WPF: Binding TreeView In XAML

Dec 8, 2010

I have a data source:

[Code]....

View 2 Replies

Xaml Data Binding To My Class?

Sep 9, 2011

I have the below xaml that I am trying to bind to my class. I am having trouble getting the values to show up.

code]...

View 2 Replies

Xaml Writer How To Remove Xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

Sep 17, 2009

I need to use the xaml writer to convert in string some controls. What I get is a string like this for example

[code]...

View 1 Replies

Binding With SQL Command Text?

Aug 10, 2009

I am trying to get a set of records from the database to show. This page is setup like a search page with two combos for the data, one for a location, and four for different characteristics. Using this data I created a SQL command text that I checked against the database and it works as a script file. I put this in my code with the changes needed for it to run in VB.Net and I am getting an ObjectNull Reference not set to an instance of an object. It is being caught by my try statement so I only have the line number. Here is the code where it is happening.

[Code]...

View 11 Replies

Execute A Command Binding On MouseEnter Of A StackPanel In WPF?

Jun 30, 2010

I'm using MVVM.

<ItemsControl ItemsSource="{Binding AllIcons}" Tag="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>

[Code]...

I'm able to capture the command. However, I want to execute the command binding when the mouse enters the stack panel, not when I click a button.

View 3 Replies

.net - WP7 Custom Class UI Binding?

Feb 4, 2011

I have a map with a MapItemsControl in my WP7 app that contains pushpins bound to items in a collection of custom classes. The pushpins are bound to properties of the item in the collection via a DataTemplate.When an item is added to or removed from the collection, all pins display correctly, with properties as per bindings, but when just an items' properties are modified, the UI does not update. The bindings just seem to get values from the source item upon loading, but I'd like them to keep the UI elements updated when the source collection items' properties are updated.To illustrate, I'll create a similar example:

Heres a custom class:

Public Class Box
Property CurrentColor As Color
Property Location As GeoCoordinate
End Class

[code]....

Whenever I add or remove items from TempBoxes, the pins all render as they should (e.g. if I specify a color in the collection item, the pin shows the color).Tapping on the item triggers the BoxTouched sub, which causes the item's color to change in the collection, but the UI doesn't change (pin color stays the same).To get the UI to update the color, I have to get it to render the pins again, by adding something like this to BoxTouched:

BoxControl.ItemsSource = Nothing
BoxControl.ItemsSource = TempBoxes

View 1 Replies

Custom Object Master-Detail Data Binding?

Sep 22, 2011

Custom Object Master-Detail Data Binding

View 2 Replies

Winforms Data Binding: Custom Classes Or Datatable?

Jul 8, 2009

Am in the process of architecting a new windows forms application, and I intend to use Visual Basic 2008 and SQL Server Express 2005. This is my first application in .Net and I really want to observe the best OOD & OOP principles to create an application that is easy to maintain and extend (add new functionality). My issue is in regard to databinding on the UI. From experience, what do you guys recommend to use for databinding? Should I return datasets/datatables from my Business Layer and bind these to UI controls or should I return Business Objects and bind these to UI controls? And what are the pros and cons of each approach?

View 1 Replies

Specify A Custom Icon For Display In The Toolbox Window When Create Own Custom Control?

Dec 29, 2011

how to specify a custom icon for display in the toolbox window when you create your own custom control? Something other than the dreaded "gearbox" icon.

View 2 Replies

C# - WPF: Custom Command Not Working?

Dec 3, 2010

In my XAML I have this:

<UserControl.CommandBindings>
<CommandBinding Command="Help"
CanExecute="HelpCanExecute"
Executed="HelpExecuted" />
</UserControl.CommandBindings>

[Code]...

But i get the error: Cannot convert string 'MyCustomCommand' in attribute 'Command' to object of type 'System.Windows.Input.ICommand'. CommandConverter cannot convert from System.String. What am I missing here? And please note that I want to do it all in XAML, i.e. don't want to use CommandBindings.Add(new CommandBinding(MyCustomCommand....

View 1 Replies

Custom Control With Custom Collection Property?

Jul 11, 2011

I have an ASPX Custom Control which is supposed to load it's properties into an internal collection (defined with PersistenceMode.InnerProperty). Here's the ASPX

<cc:CustomControl runat="server">
<Queries>
<cc:QueryTypeOne ... />

[code]...

View 1 Replies

Changing Text Of Custom Control Based On Text Of Another Custom Control

Jan 11, 2010

I am using custom textboxes and I need to be able to set the Text on txb1 based on the Text of txb2. I have simplied my code to the following:

Public Class customtextbox
Inherits TextBox
Public Event ControlReset()

[Code]....

So, when txb1 looses focus, if its Text is "fried", then it sets off txb2's ProcessAlert function. I had tried to change the value of txb2 Text in ProcessAlert function, but didnt work, so I tried to get it to raise an event instead, which then tries to set the Text property. However I still cant set txb2's Text property. The Text property seems to be set for the duration of the "life" of the Event handler. When I step through the forms controls within the Event handler, the changed Text value is there, but not outside of the Event handler.

View 2 Replies

Command Line Argument Specifying Custom Constant

Jan 30, 2011

Can VisualStudio VisualBasic be opened with a command line argument specifying a custom constant for conditional coding? Instead of specifying it at "properties > Compile > Adv Compile Opts > Custom constants", I would like to just run a .BAT file that opens VisualStudio/VisualBasic and my source code with the "Custom constant" already set for the conditional coding.
Software Developer

View 4 Replies

Adding Custom Command In A Shortcut Menu (right Button)

May 11, 2009

Is it possible to add custom command in a shortcut (.lnk) menu (right button) through .net? How can i add the command and executed that command.?

View 4 Replies

Handles Button.click Event From Custom Control Inside Other Control?

Jul 29, 2009

I've created my own ascx control with button inside it. Now I'm using this control inside other control. (In my case it is a webpart). What I would like to do is program button.click logic from my custom control inside webpart

View 4 Replies

Can A Custom Control NEW Sub Be The Only One That Executes When Inheriting From An Existing Control

Jul 17, 2011

Can a custom control NEW Sub be the only one that executes when Inheriting from an existing control please?I am Inheriting from TabControl and I do not want the base New Sub called, is this possible?In other words, I do not want TabPage1 and TabPage2 to be added.A Form has an Activated Sub which runs once a Form is activated.It is a pity that Microsoft have not got such a method in the baseControl Class otherwise I could have used it within a custom TabControl.

Public Class Form1
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
End Sub

[code]....

View 8 Replies

Embed A SilverLight Control In ASP.NET Control (user Or Custom)?

Apr 29, 2010

We have a ASP.NET web application written in VB.NET where we build content programmatically during the Init event.We make extensive use of user controls, building them on the fly, and I now want to start including SilverLight content.Is there an easy way of embedding a SilverLight application in a control, and then instantiating the whole thing in code, in the same way as you'd programmatically add ordinary ASP.NET controls to a page?The SilverLight component itself works fine when added to a page using the <object> tag but I really want to be able to reuse it elsewhere in code.Since I'm expecting use of SilverLight to increase in our application, and the asp:Silverlight control seems now to be deprecated, I'm looking for an alternative way of wrapping the content.

View 1 Replies

.net - User Control And Binding?

Mar 11, 2010

I've created a custom control which consists of two radio buttons with their appearance set to "Button". This control is meant to act like two toggle buttons with an "On" toggle button and an "Off" toggle button. I have a public boolean property "isAOn" which is used to set the state of both buttons and I want to be able to bind this property to boolean values. I have imported the component model and set Now when I add this to a form for a boolean value in one of my classes it doesn't seem to update the boolean value of the class when I change the button pressed.

Here is the code:

Imports System.ComponentModel
''#
<DefaultBindingProperty("isAOn")> _
Public Class ToggleButtons

[code]....

View 1 Replies

C# - WPF: Control Losing Its Binding?

Nov 26, 2010

I have a MenuItem of a context menu of a Grid and its IsEnabled property is bound to MyProperty. It works fine until I actually click on the event handler of the MenuItem, which has no code in it. After I have clicked on the MenuItem the dataBinding no longer works.

I can tell cos' my breakpoint in the getter of MyProperty does not get hit.

[Code]...

View 2 Replies

Get Custom Properties For A Custom Control Into The Visual Studio Properties List?

Nov 25, 2009

What I've done is create a User Control Library (Project) and I've added a single User Control to that project. The control contains a single FlowLayoutPanel, and I created a Property on the control itself to pass the FlowDirection from the Control to its FlowLayoutPanel child.

Build, reference, component appears in the Toolbox and everything works fine, but the property on the control does not appear in the Properties window when I go to edit it at design time.

View 6 Replies

Binding - When Does Control And Source Sync?

Oct 8, 2010

First: I have a numericUpDown and a class that are bound.

Me.percent.DataBindings.Clear()Me.percent.DataBindings.Add("Value", options, "percent")When I change the numericUpDown the underlying class seems not to update. I have to click outside the numericUpDown to force validation and force syncing. This is very counterintuitive and will cause problems. How can I make sure the underlying data object gets the new value on valuechange rather than validate?

Second: After I change the numericUpDown I have an option that serializes the underlying data in an xml file. The underlying XML file does not always get the right data. To figure out what is happening I added a button that outputs the values of the underlying data object and it is always getting updated. In other words...the control and the object values always agree. The serialize

[Code]...

View 2 Replies

C# - Binding Property To Control In Winforms?

May 4, 2011

What is the best way to bind a property to a control so that when the property value is changed, the control's bound property changes with it.So if I have a property "FirstName" which I want to bind to a textbox "txtFirstName" text value. If I change FirstName to "Stack" the txtFirstName.Text also changes to "Stack".

View 1 Replies

Forms :: Binding Control To SQL And Updating

Sep 15, 2010

I have controls on a form, bound to an SQL data source. The information populates the control well. When I change the text in a bound textbox, I want it to be reflected in the SQL database. When I change the text in the control, the DataSet is updated. Now I need to make the DataSet update the SQL table.

[Code]...

View 1 Replies

User Control Property Binding

Nov 15, 2009

Nothing binds to my user control. It will bind to other controls. code for UC property:

#Region "IsOn"
'Public Sub IsOnValue_Changed Handles
Public Sub Me_IsOnChanged() Handles Me.IsOnChanged

[Code].....

View 10 Replies

User-Control Property Binding?

Feb 25, 2012

I develped custom DateTimepicker in vb.net that users can pick date in persian lanquege with it.in my main contrl class i have bindable property with name "Value". here is the property code :

<Editor(GetType(TypeEditor), GetType(UITypeEditor)), Browsable(True), _
Bindable(True)> _
Public Property Value As String

[code].....

View 5 Replies

Binding Database Table With DataGridView Control?

Jul 10, 2010

I have one textbox at form named "Ord ID". I have bind database table with datagridview control and now on load event data is displaying correctly. In Datagridview there is one column which is checkbox type, suppose at datagrid there are 10 records displaying, and I have tick 6 checkbox for 6 records, so when I press add button then the value exist in textbox automatically comes to only six records of Datagridview column named "StatusID".

View 1 Replies

Control Binding DropDownList Before Display Items?

Dec 22, 2010

Im using Visual Studio 2008 (ASP.net) to build some web pages..

I have a DropDownList linked to a DataSource from data base to fill it automaticly, and it works perfect, but I want to modify the items before its displayed ?

View 4 Replies

Control Moving Between Record Thru Binding Navigator?

May 27, 2009

i want to control the functionality of moving the records thru binding navigator in vb.net

for example, on click of next button in navigator, i want to check some condition, if condition is true then move to next record otherwise don't move.

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved