I know it's a generic title, but my question is specific. I think it will boil down to a question of practice. So, I have the following code:
public class Component : UIElement
{
public Component()
{
this.InputBindings.Add(new MouseBinding(SomeCommandProperty, new MouseGesture(MouseAction.LeftClick)));
}
}
I could easily aggregate the ViewModel that owns SomeCommandProperty into the Component class, but I'm currently waiving that option assuming there is another way.
Component is a child of ComponentCollection which is child of a Grid which DataContext is the ViewModel. ComponentCollection as the name suggests contains a collection of Components.
<Grid Name="myGrid">
<someNamespace:ComponentCollection x:Name="componentCollection"/>
</Grid>
It's the same scenario as the XAML below, but with TextBlock. I guess I'm trying to replicate what's being done in the XAML below programatically. Again, Component's top most ancestor's DataContext is set to ViewModel.
<Grid Name="myGrid">
<TextBlock Text="SomeText">
<TextBlock.InputBindings>
<MouseBinding Command="{Binding SomeCommandProperty}" MouseAction="LeftClick" />
</TextBlock.InputBindings>
</TextBlock>
</Grid>
Update 1
Sorry, I'm unable to comment because I lack the reputation points.
Basically, I have a custom control which inherit from a Panel which children are a collection of Component. It's not a hack, like I've mentioned, I could directly have access to SomeCommandProperty If I aggregate the ViewModel into Component. Doing so, however, feels icky. That is, having direct access to ViewModel from a Model.
I guess the question I'm asking is. Given the situation that Component's parent UIElement's DataContext is set to ViewModel, is it possible to access SomeCommandProperty without Component owning a reference to the ViewModel that owns SomeCommandProperty? Programatically, that is.
Using ItemsControl doesn't change the fact that I still need to bind SomeCommandProperty to each Items.
Hi, does anyone know how to define a SeekBar's minimum value? Is this done in the XML layout or do I need to define it programatically?
Basically I need to change my minimum value from 0 to 0.2
I've seen lots of scripts out there for manually stopping/starting services in a list, but how can I generate that list programatically of -just- the automatic services. I want to script some reboots, and am looking for a way to verify that everything did in fact start up correctly for any services that were supposed to.
Hi,
I'm trying to sum up a column in Excel VBA , however because there are blank spaces, I'm getting 0 as the sum.
Dim rExternalTotal As Range , dExternalTotal as Double
Set rExternalTotal = Range(rReportData.Offset(0, 0), rReportData.Offset(261, 0).End(xlUp))
dExternalTotal = Application.WorksheetFunction.Sum(rExternalTotal)
dExternalTotal is always zero. I cannot delete the blank spaces on the work sheet. Can anyone suggest a way to do the sum programatically?
I've been trying to programatically feed the paper on a pos printer (Epson TM-U220D). The problem I have is that the last line of the document don't get printed, instead, it is printed as the first line of the next document printed. I tried POS for .NET sending the "ESC|flF" command, also tried to send the raw esc/pos command using the serial port, but it doesn't work. Any ideas?
Without using the private APIs, is it possible to programatically determine the MAC address of the access point that the iPhone is connected to?
I understand that this should be doable using the core BSD libraries, but we are new to this, so it would be great if someone can point us to some starter code.
Note: we're trying to determine the MAC address of the remote device - not the MAC address of the iPhone.
Can anybody please tell me the registry setting(s) that are affected in Windows Mobile 6.1 when a user selects Start - Settings - Connections - Wi-Fi and then changes the value of the "My network card connects to" drop down list on the "Network Adapters" tab?
I have a device that seems to default this to "The Internet" when in fact the Wi-Fi connects to the corporate network and I would like to be able to change this programatically rather than expecting 250+ users to have to do it manually every time they reboot their devices.
Thanks.
I am using the GPC Polygon Clipping lib (http://www.cs.man.ac.uk/~toby/alan/software) and want to create a polygon programatically. I only see code for how to create one from a file. How can I do the initialization in my code?
I'm using Delphi 7, totally new to database programming, and need ODBC. I am told that ADOExpress is a good way to go, and that seems fair enough as it comes with Delphi 7.
I need to programatically create, populate, modify and query a database (currently MySql, but that might change, hence ODBC). Can anyone recommend a good tutorial? Thanks.
In Windows 7 (and Vista I think), a network you're connected to is assigned to a "location" e.g. Home / Work or Public.
Is it possible to determine the current network location programatically?
Hi,
Is there a way for session management or security available programatically in Jersey specification.
e.g. like a web-application session management.
Or is transaction, session, security all handeled by the containor on which the jersey application is deployed.
Adhir
I have an IFRAME that should be filled with content from JavaScript. Had the content be on the server all I had to do is:
function onIFrameFill() {
myIframe.location.href = "HelloWorld.html";
}
But the content I have is a HTML page generated on the client and represented as a string (I have not much influence on it). How can I populate the content of the my iframe programatically?
Hello guys,
A quick question: how do I programatically select the text fragment of the page in FireFox? For example, there's a paragraph of text, user clicks the button and symbols from 10-th to 15-th are selected as if user dragged a mouse in a regular way.
Hi,
I want to programatically create list on Sharepoint using Web Services.
I tried "Lists.AddList Method" but it would create list in current site only.
Is there any other way to create list? (Using Web Services : C#)
Hi,
Does anyone know how to disable duplicate comment detection in Wordpress (2.9.2)? I'm looking for a way to do this programatically without editing core files. We're adding comments via XMLRPC and the duplicate detection in wp-includes/comment.php (line 494) is causing issues during testing.
Thanks!
I need to parse some HTML files, however, they are not well-formed and PHP prints out warnings to. I want to avoid such debugging/warning behavior programatically. Please advise. Thank you!
Code:
// create a DOM document and load the HTML data
$xmlDoc = new DomDocument;
// this dumps out the warnings
$xmlDoc->loadHTML($fetchResult);
Hi,
I would like to open a webpage and run a javascript function from within a java app.
For example I would like to open the page www.mytestpage.com and run the following javascript code:document.getElementById("txtEmail").value="[email protected]";submit();void(0);
This works in a browser...how can I do it programatically?
Thanks!
my movie is 500 by 200 px. However i am loading display object much larger than that and have just a portion of them show. How do i programatically get the visible dimesions? root.stage.width gives me the extended value.
for the sake of good programing practices i dont want to hardcore the values.
Hello world!
I have an .exe application written in vb.net. When I make shortcuts to the application, say on desktop (or anywhere else) and then click on them I want to programatically get the path to that shortcut, ie. C:/Users/xxx/Desktop/shortcut.lnk.
I want this so I can store the pairs shortcuts : (program + different cmd args).
I've created an in memory hsqldb and am using the default database/schema. Now I want to drop and recreate the database programatically.
How do I do that?
Thanks
Daniel
Hello
I've a text editor in my application. I want to programatically set the input language for the text editor alone without affecting other controls.
Any ideas?
Regards
NLV
Is it possible to clear a notification programatically?
I tried it with the NotificationManager but its not working.
Is there any other way i can do it?
I tried to access xp to vista system manually, its working,but programatically how to do it ?
like,by selecting view workgroup computers in network tasks and click one computer in workgroup computers.it shows connect to "system name" window, contains username and password
if i enter username and password.the seleted computer will able to access in registry
otherwise i can't able to access that selected system.
how to do this manual process in vb.net coding? is it possible or not?
please help me
Hi All,
I've gone through all helps and all forums., but none of them have helped me. Here is my problem
Developing a site on localhost using ASP.NET 3.5
I want to provide 'forgot password' functionality using <asp:PasswordRecovery>
Any real help is greatly appreciated. Please note that I want to send it by either changing web.config OR programatically.
Thanks