|
|
Prism (Composite Application Lib) allows multi targeting of both WPF and Silverlight....has some good how-tos also
C# has already designed away most of the tedium of C++.
|
|
|
|
|
Hello
I can not work out how to find a objects ancestor in the following context.
I have a Tab control which has three Tab Items a, b and c. Each Tab Item has a frame which in turn hosts a page. Each Tab Item will host the same page.
The page contains a canvas with custom built graphical objects all inheriting framework element. I would like to make the visibility of my graphical objects dependent on the Tab Item.
For example if the page finds its ancestor of type Tab Item , name property to be "b" then only certain objects would be made visible. At initialization of the object i would like to look up the ancestor tree till i reach type Tab Item and then compare the Tab Item name to another object property and then set the visibility property.
Thanks
Dane,
|
|
|
|
|
You didn't mention whether it was WPF or Silverlight. In WPF, you can use the VisualTreeHelper object. It exists for Silverlight as well, but I think it's less capable.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hmm... Off the top of my head, I think this could be solved with a couple attached properties...
Not sure how familiar you are with them, but attached properties in WPF are basically properties that are based on one class, but can actually apply to any DependencyObject of a given base type. They're most similar to the IExtenderProvider functionality in WinForms, except that they can ALSO inherit to child objects... So if you set the value on the TabItem, then all of its children can read that value too, as if it was on each of them.
1) Create two attached properties:
- a) ParentTabName, with a type of TabItem. For each tab, bind that property to the tab name ({Binding TabName,RelativeSource={RelativeSource Self}} if memory serves).
- b) TabVisibilityCodes, with a type of string. For each child control that needs to be shown/hidden, set that property to, say, a comma-delimited list of the names of tabs it should be shown on. All of this can be done in XAML once the properties are created.
2) In the setter for either property (The getters/setters are all in one place, not on each object), compare the two attached properties for the element in question, and update its visibility accordingly.
|
|
|
|
|
int _result = ((int)(base.EndInvoke("UserExist", _args, result)));
WHEN I TRY TO LOGIN
USING VS 2010 PRO/SQL DEVELOPER R2
|
|
|
|
|
|
Hello,
I have a DrawingGroup with nested children created from SVG files and want to render/convert this a corresponding nested DrawingVisual/Visual.
A simple rendering process as follows...
DrawingGroup group;
DrawingVisual visual = new DrawingVisual();
visual.DrawDrawing(group);
will correctly render the drawing graph, but the resulting visual does not contain any child visual, only a single visual with no child is created.
The children of the root drawing may also have children with transform(s), which is the may cause of my current failed attempt.
I need the nested visual to perform interactive operations. Anyone done a similar thing and will not mind to share his/her algorithm?
Paul.
Jesus Christ is LOVE! Please tell somebody.
modified on Tuesday, August 17, 2010 2:03 AM
|
|
|
|
|
I used the custom Rendering Ink to build a custom brush. I create a customized dynamic renderer that derives from the DynamicRenderer and override the OnDraw method. In OnDraw method, i need to do a lot of drawEllipse(). After that, the computer becomes very slow. Guys, do you have any solutions about that?
Thanks a lot!
|
|
|
|
|
Dear All,
I have a Page name first.aspx, from where i click on go to second.aspx. This second.aspx page has silverlight object.
In silverlight object i use
System.Windows.Browser.HtmlPage.Window.Navigate(New Uri(strUrl, UriKind.RelativeOrAbsolute), "_self", "")
to come back to first.aspx, but it works like back button of browser, means this page not showing the updates i have done in second.aspx. I have to refresh the first.aspx to see the new changes.
So how could i navigate to the page with page refresh in silverlight.
Thanks
|
|
|
|
|
HI All,
I got the solution for the same. Sharing with u
HtmlPage.Window.Eval(String.Format("window.location.href='{0}';", strUrl))
Thanks
|
|
|
|
|
Hi,
I am working on WPF browser application. i am facing below issue
how to bind different tables to wpf datagrid combobox column ?
i have wpf datagrid, in that grid 2 combo box columns are there , 1 st column is Country and second column is state, both are datagridcombo box columns only, here depend on the country column i need bind diffrent table to state column. so each row i need to bind different table to state column . so how to achieve this task?
Thanks
Sekhar
|
|
|
|
|
I have some simple .net control that i want to add into wpf window.
i trying to add it by using "choose toolbox item" that appear on the IDE - but i dont see the item => so i can't add the object to my WPF window.
How cani do it ?
Thanks for any help.
|
|
|
|
|
If you control is not a WPF control, this may not be possible.
|
|
|
|
|
The control is .net but not WPF
is it possible in this case ?
If its possible - so how can i do it ?
Thanks
|
|
|
|
|
Yanshof wrote: If its possible - so how can i do it ?
It is possible.
See any of these to check if they help.
Here[^] or here[^].
|
|
|
|
|
|
You are welcome.
|
|
|
|
|
Hi
Currently I have written my application to play one media file at a time:
1. Open file dialog is used to select a file
2. File is copied into the media source. mediaElement1.source = (new Uri(file))
3. Then it is played from start to end. mediaElement1.Play();
This works fine, however now I would like to play files which have been loaded into a list box one after the other. I have tried using the foreach loop to attempt to access each file by its index and well looking through the code (using F11) found that all that happened was it would try and load all the files one after the other with out waiting for the current file to complete playing. How do I get it to wait until the current file has finished playing? here is the code that has gone wrong:
int x = lstBx.Items.Count;
for(int i = 0; i<=x; ++1)
{
string cMedia = lstBx.Items[i]as string;
mediaElement1.Source = (new Uri(cMedia));
mediaElement1.Play();
}
Also bearing in mind that the ideal condition for the media element to have completed playing a file is: mediaElement1.Position == mediaElement1.Position.Totalseconds
Please note that the application is being developed under WPF.
|
|
|
|
|
You can set an event handler for the Completed event on your mediaElement. When that event is fired, load the next file and play it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I have been working on this for a day or two and can't seem to find the answer on the internet, or at least I don't get the answer if I have seen it.
I have a window showing various settings for an object:
<Grid x:Name="PalletGrid">
<Grid.DataContext><XmlDataProvider x:Name="xmlPalletConfiguration" XPath="/PalletConfig/Pallets/Pallet"
Source="C:\ProgramData\Pallet Configuration.xml" />
</Grid.DataContext>
<TextBox x:Name="PickupSequenceTextBox" Text="{Binding XPath=/PalletConfig/PickupSequence}"/>
<TextBox x:Name="DropoffSequenceTextBox" Text="{Binding XPath=/PalletConfig/DropoffSequence}"/>
<ComboBox x:Name="SelectedPalletComboBox" ItemsSource="{Binding Mode=OneWay}" IsSynchronizedWithCurrentItem="True"
SelectedValuePath="@display" DisplayMemberPath="@display"/>
<TextBox x:Name="RowCount" Text="{Binding XPath=Rows}"/>
<TextBox x:Name="ColumnCount" Text="{Binding XPath=Columns}"/>
<TextBox x:Name="ColumnDimension" Text="{Binding XPath=YDimension}"/>
<TextBox x:Name="RowDimension" Text="{Binding XPath=XDimension}"/>
</Grid>
The Pallet Configuration.xml file I'm databinding to looks like this:
<PalletConfig>
<NumberOfPallets>2</NumberOfPallets>
<CurrentPallet>3/8</CurrentPallet>
<PickupSequence>B</PickupSequence>
<DropoffSequence>A</DropoffSequence>
<Pallets>
<Pallet display="6.0mm">
<Rows>10</Rows>
<Columns>10</Columns>
<XDimension>100.000</XDimension>
<YDimension>100.000</YDimension>
<PalletALocation>295, -5, -19, 0, -8, L</PalletALocation>
<PalletBLocation>93, -6, -19, 0, 0, -8, L</PalletBLocation>
</Pallet>
<!--More pallet tags ...-->
</Pallets>
</PalletConfig>
I set the datacontext for the grid to be at the individual pallet level. When I select a new pallet in the combo box, all of the textboxes below update with the values for the selected pallet.
What I can't figure out how to do is databind the <CurrentPallet> in the XML file to the selected item. I want it to save the selected item so the next time the application is ran, the combobox will select the pallet type that was last selected.
I've tried binding to the selecteditem, but haven't been successful. Nothing I have tried has updated the <CurrentPallet> tag when the changes were saved. Also, whatever I have tried made the combobox display a blank line the first one or two times you select a pallet type. It would display like it whould after that. I've also heard that the selecteditem doesn't do well with updating the combobox when whatever it is bound to changes, not that it matters I only want to do this at startup. Any solution that works will be appreciated.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
Here's how I would do it...
Grid: DataContext = /PalletConfig
- 2 TextBoxes bound to the two sequence numbers
- ComboBox: ItemSource bound as you have it now, SelectedIndex bound OneWayToSource to /PalletConfig/CurrentPallet
- Some container (Panel, groupbox, border, etc - Just to organize it) for other textboxes, DataContext bound to ComboBox.SelectedItem (ElementName binding)
-- Textboxes bound to rows, columns, dimensions
Unless the pallets will be shuffled around, storing the index seems like it should be enough, right?
|
|
|
|
|
I was hoping to bind to the name displayed (they are always unique) because the pallets can be shuffled around in the file. The users can move the <Pallet> tags so the pallets they use more often can be at the top of the list.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
Ah, that's a bit more tricky. The thing about binding is that one end of the bind MUST be a DependencyProperty on a DependencyObject. You really want to bind one field in your XML file to another, or alternately bind one property to two different values (Source1 = SelectedItem, Source2 = CurrentPallet).
I don't think you can do either, unfortunately. Your best bet might be to just hook the ComboBox's selection changed and update CurrentPallet in the code-behind. Then you can hook its DataContextChanged to initialize its SelectedItem to the CurrentPallet.
|
|
|
|
|
That's was kind of the route I had planned. It didn't make sense for the datacontext to open the file and me opening in the code-behind. Being that I'm new to databinding, I was hoping there was something easier I could do.
Thanks for your efforts.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|