Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

Wpf ListBox Hosting Windows Form Contols : Drawing Problem

$
0
0

Hi All,

I have a windows form image control(For Demonstration purpose, basically it is a WindowForm UserControl Hosting ActiveX Flash Player Control. ) inside  WFP - ListBox,

When i am scrolling Down and Up in ListBox. Windows form control is not Drawing correctly, it is going out of the ListBox..

XAML Code...

<Window x:Class="WPF_Demos.Window3"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:UC="clr-namespace:WPF_Demos"
        xmlns:win="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        Title="Window3" Height="500" Width="500"><!-- Set the ItemTemplate of the ListBox to a DataTemplate which
                explains how to display an object of type BitmapImage. --><Window.Resources><Style TargetType="{x:Type ListBox}"><Setter Property="ItemTemplate"><Setter.Value><DataTemplate><StackPanel><WindowsFormsHost x:Name="winhost"><win:PictureBox x:Name="picbox"  Width="200" Height="200" SizeMode="StretchImage" ImageLocation="C:\DOTNET\WPF\WPF_Demos\WPF_Demos\Images\Desert.jpg"/></WindowsFormsHost></StackPanel></DataTemplate></Setter.Value></Setter><Setter Property="ItemsPanel"><Setter.Value><ItemsPanelTemplate><WrapPanel /></ItemsPanelTemplate></Setter.Value></Setter><Setter
                    Property="ScrollViewer.HorizontalScrollBarVisibility"
                    Value="Disabled"
                /></Style></Window.Resources><Grid><ListBox x:Name="lstImgs" ScrollBar.Scroll="lstImgs_Scroll" Margin="100"  ListBox.MouseDoubleClick="StackPanel_MouseDoubleClick" ItemsSource="{Binding }"/></Grid></Window>

C# Code:

 this.DataContext = System.Linq.Enumerable.Range(0, 30);

I have read lots of article 

http://bartwullems.blogspot.in/2010/11/wpf-and-winforms-airspace-problem.html

After reading this article i got to how to solve AirSpace Problem when u have single control. Not like ListBox hosting Multiple WindowsForm Control.

and I have read this forum thread ....

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/1e1a9728-1b1b-4336-afe7-5513c1beb3cc

I want to know that how to solve this problem.

please help me...


Vikas Gupta


custom MultiDataTrigger support for Grid and StackPanel?

$
0
0

Hello,

i need to use DataTriggers in a lot of pages, that have also be edited by customers in a simple way. 

In default Control Triggers i can only use EventTriggers. I dont want to use DataTemplate on every place, to get MuliDataTriggers or DataTRiggers working.

Do you have any idea  how i can make StackPanel and Grid to have MultiDataTriggers?

Thank you a lot.

Best regards,

Simon


tu es, oder lass es

WPF App crash on a Win 7 64 OS

$
0
0

I have some trouble with my App, WPF C#.NET 3.5 VS2008, at one customer machine. My App has nearly 1000 Installation on different windows machines (XP, Vista 32/64, Win7 32/64) and no problem so far.

Our Customer does Setup a new clean (as he said) Win 7 64 OS, but the Problem still exist. Using WPF Apps seeems to be not working.

I have tried also to use the MVVM Demo App of this Article (msdn.microsoft.com/de-de/magazine/dd419663.aspx) by John Smith at the Customers Machine.

The MVVM Demo App crashes also, when i try i click to a Menu-Item, Button or select something in a DropDown-List. Enter a Text in a Textfield is okay, but click and select does stop the MVVM Demo App with the Error that the Application does not work.

Here a Event-Log of my App

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    - <System><Provider Name="Application Error" /><EventID Qualifiers="0">1000</EventID><Level>2</Level><Task>100</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime="2013-02-07T11:04:13.000000000Z" /><EventRecordID>2243</EventRecordID><Channel>Application</Channel><Computer>RSSec.Machine.local</Computer><Security /></System>
    - <EventData><Data>MyApp.exe</Data><Data>2.0.16.0</Data><Data>51136bd8</Data><Data>unknown</Data><Data>0.0.0.0</Data><Data>00000000</Data><Data>c000041d</Data><Data>74494f0d</Data><Data>ecc</Data><Data>01ce0522d9d3bc67</Data><Data>C:\Program Files (x86)\MyApp\MyApp.exe</Data><Data>unknown</Data><Data>1ad6d91f-7116-11e2-87c7-10604b689bfe</Data></EventData></Event>

Thx for any help

In a WPF app, bullets are not getting displayed in the password box

$
0
0

In our WPF app we have a PasswordBox, which by default, displays bullets for characters typed in it. For a particular user(XP SP3), this was working fine until a month back when he could not enter anything in the password box. In order to find if any changes we had recently made to the product had caused it or was it something entirely different, I created a small app having just a text box and password box and a button. On click of the button, contents of the text box and password box are displayed in a message box.

XAML:

<Grid><Grid.RowDefinitions><RowDefinitionHeight="*"></RowDefinition><RowDefinitionHeight="*"></RowDefinition><RowDefinitionHeight="*"></RowDefinition></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinitionWidth="*"></ColumnDefinition><ColumnDefinitionWidth="*"></ColumnDefinition></Grid.ColumnDefinitions><TextBlockGrid.Row="0"Grid.Column="0"HorizontalAlignment="Right"VerticalAlignment="Center">User Name:</TextBlock><TextBoxx:Name="usr"Width="120"Height="30"Grid.Row="0"Grid.Column="1"></TextBox><TextBlockGrid.Row="1"Grid.Column="0"HorizontalAlignment="Right"VerticalAlignment="Center">Password:</TextBlock><PasswordBoxx:Name="pass"Width="120"Height="30"Grid.Row="1"Grid.Column="1"></PasswordBox><ButtonHeight="30"Width="60"Grid.Row="2"Grid.ColumnSpan="2"Click="Button_Click">Ok</Button></Grid>

Code behind:

privatevoidButton_Click(object sender,RoutedEventArgs e){MessageBox.Show("Username: "+ usr.Text+", Password: "+pass.Password);}

On running the app, we discovered that the user was actually able

to type in the password, and it was getting displayed correctly on

clicking OK. He was simply not seeing the bullets. I tried changing

the font size and foreground but to no effect. I have the same

configuration on my machine and it works fine for me. At last I

changed the password char to '*' and that is getting displayed fine

on the user's machine. Any help on why the bullets are not getting

displayed?

I tried setting the font for the passowrd box explicityly.

<PasswordBox x:Name="pass" Width="120" Height="30" Grid.Row="1" Grid.Column="1" FontFamily="Times New Roman"></PasswordBox>

But still no success

How to set selected item of RibbonMenuButton item in WPF Ribbon Control Library

$
0
0

Hai,

I am using WPFbon control library in my application . I have created a RibbonMenuButton and binded a list to its ItemSource .The Problem is i cant set any of these items as selected (to get selected item/index). There seems to be no property in this control which allows me to do this.

 Any help on this is appreciated.

-------------------------------------------------------

Thanks,

Revathi


wpf + passing values from parent window to popup window

$
0
0

Hi Experts

I have a parent window with a button, in that button click opening a popup window by using ShowDialog() method.

 I need to pass values from mainwindow to child window based on those values I need to fetch some data from database and bind to combobox.

Please can some one help me to pass values between parent and child window.

Thanks in Advance :)

MVS 2012 stops and restarts when I am trying to add new table.

$
0
0

I am having a problem with my Visual Studio 2012. It always stops working and restarts whenever I am trying to add new table (Visual Basic). Please help me. This is so urgent.


ListView SelectedValue lost after Async updated ItemsSource Item

$
0
0

The WPF app is developed strictly in MVVM pattern

Let's say I have a List included 3 items in ViewModel

var Items = new List<Item> { Item1, Item2, Item3}

<ListViewMargin="5,5,5,20" SelectionMode="Single"	SelectedValue="{Binding SelectedItemObj}"IsSynchronizedWithCurrentItem="True"ItemsSource="{Binding Items, Mode=OneWay}">

And the user click on the grid on Item2
So, the SelectedValue = Item2

A service async updated the Items collection at seperate thread by

Items[1] = NewItem;

Because of that, the SelectedValue in the ListView is lost

And one of the side note is that the async update is very frequent

Please hope if there's anyone who can suggest a solution for me

Million Thanks


WPF DataGrid Virtualization

$
0
0

Hello,

 

AFAIK, virtualization in WPF Datagrid is turned on by default; but I am not seeing that is the case in my application.

From WindDbg, it looks like the application is trying to draw all the data grid cells.  Is there anything else that I need to do to enable virtualization?

Any suggestions on how to figure out why virtualization is disabled?

 

Ty much,

Augustine

 

!dumpheap -stat

...

65deb504    84270     29325960 System.Windows.Controls.TextBlock

65df45a0   140167     35882752 System.Windows.Controls.DataGridCell

..

65dea4dc   224512     56577024 System.Windows.Controls.ContentPresenter

..

XAML:

<Grid>
        <DataGrid RowHeaderWidth="43" MinRowHeight="24" CanUserResizeRows="False" CanUserAddRows="True"
                  AutoGenerateColumns="False" EnableRowVirtualization="True" RowDetailsVisibilityMode="Collapsed"
                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True"

 

TreeViewItems not displaying checkbox in heirarchicaldatatemplate

$
0
0

Hi,

I have a treeview with heirachical data for 4 levels.

The heirachicaldatatemplate is designed to display checkboxes.

Heirachicaldatatemplate's Itemsource is binded to "Models" which is an observable collection of class Model, implements TreeViewItem Class.

But on runtime, checkboxes are not displaying in the treeview.

Please help me out.

Here are the code:

publicclassModel : TreeViewItem

{

public Model()

{

}

publicstring Caption

{

get {return (string)GetValue(CaptionProperty); }

set { SetValue(CaptionProperty,value); }

}

publicstaticreadonly DependencyProperty CaptionProperty =

DependencyProperty.Register("Caption",typeof(string), typeof(Model), newPropertyMetadata(String.Empty));

publicObservableCollection<Model> Models

{

get {return (ObservableCollection<Model>)GetValue(ModelsProperty); }

set { SetValue(ModelsProperty,value); }

}

publicstaticreadonly DependencyProperty ModelsProperty =

DependencyProperty.Register("Models",typeof(ObservableCollection<Model>),typeof(Model),newPropertyMetadata(null));

}

publicpartialclass HCOmboBox : Window

{

publicObservableCollection<Model> Models

       {

           get { return (ObservableCollection<Model>)GetValue(ModelsProperty); }

           set { SetValue(ModelsProperty, value); }

       }

       

       publicstaticreadonlyDependencyProperty ModelsProperty =

           DependencyProperty.Register("Models",typeof(ObservableCollection<Model>),typeof(HCOmboBox),newPropertyMetadata(null));

}

<Style x:Uid="Style_6" TargetType="{x:Type TreeViewItem}" x:Key="2"

BasedOn="{StaticResource {x:Type TreeViewItem}}">

<Setter x:Uid="Setter_59" Property="IsExpanded" Value="{Binding Path=IsExpanded,Mode=TwoWay}"/>

<Setter x:Uid="Setter_61" Property="IsSelected" Value="False"/>

<Setter x:Uid="Setter_62" Property="Height" Value="Auto"/>

</Style>

<HierarchicalDataTemplate x:Uid="HierarchicalDataTemplate_1" x:Key="1"

ItemsSource="{Binding Models}">

<CheckBox x:Uid="CheckBox_1" ClickMode="Press" IsChecked="{Binding

Path=IsChecked,Mode=TwoWay}"

Command="{Binding RelativeSource={RelativeSource FindAncestor,

AncestorType={x:Type local:HComboBox}}, Path=CheckAll,

Mode=TwoWay}"CommandParameter="{Binding}">

<TextBlock x:Uid="TextBlock_1" Text="{Binding Caption}"></TextBlock>

</CheckBox>

</HierarchicalDataTemplate>

<TreeView x:Uid="treeview" x:Name="treeview"

ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HComboBox}}, Path=Models,Mode=TwoWay}"ItemContainerStyle="{StaticResource 2}" BorderThickness="0" Width="Auto" MinWidth="278" MinHeight="150"HorizontalAlignment="Left" VerticalAlignment="Top"ItemTemplate="{StaticResource 1}"TextSearch.TextPath="Caption"IsTextSearchEnabled="True"VirtualizingStackPanel.IsVirtualizing="True"VirtualizingStackPanel.VirtualizationMode="Recycling"/>

Binding Problem

$
0
0

I have a usercontrol made up of a datagrid and a label. I define a DependencyProperty that should change a label and a datagrid column header of the user control. The content of the label changes according to the value of the DependencyProperty but the header of the Grid Column does not.

This is my code behind:

public static readonly DependencyProperty Testing =
            DependencyProperty.Register("Testing", typeof(string), typeof(uMultipleVolume), new UIPropertyMetadata("Welcome"));

        public string _Testing
        {
            get { return (string)GetValue(Testing); }
            set { SetValue(Testing, value); }
        }

 and them my Xaml looks like this:

       

<UserControl x:Class="BAS.Company.UserControls.General.uMultipleVolume"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:commonWpf="clr-namespace:Rubenhak.Common.WPF;assembly=Rubenhak.Common.WPF"
             DataContext="{Binding RelativeSource={RelativeSource self}}"
             mc:Ignorable="d" 
             Height="Auto" Width="auto" Loaded="UserControl_Loaded" x:Name="uXamlMultipleVolume" x:Uid="uXamlMultipleVolume" >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="29" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>           
        <DataGrid x:Name="dgValues" AutoGenerateColumns="False" Grid.Row="1" Margin="5,0,5,0" Width="500" ItemsSource="{Binding}" CanUserResizeColumns="False" 
                  HeadersVisibility="Column" CanUserAddRows="False" CanUserDeleteRows="False" 
                  CanUserReorderColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" IsReadOnly="True" PreviewKeyDown="dgValues_PreviewKeyDown">
            <DataGrid.Columns>

<!-- Here i was expecting to see welcome but nothing shows up not even an error -->

                 <DataGridTextColumn Header="{Binding ElementName=uXamlMultipleVolume ,  Path=Testing}"  Width="80" Binding="{Binding Path=Pieces,StringFormat={}{0:0}}" />
            </DataGrid.Columns>
        </DataGrid>

<!-- Here the Label shows Welcome as it should -->
        <Label Content="{Binding ElementName=uXamlMultipleVolume ,  Path=Testing}"  Grid.RowSpan="2" Height="28" HorizontalAlignment="Left"  Name="label1" VerticalAlignment="Top" />
    </Grid>
</UserControl>

Thanks

Ivan

Format datetime binding application wide

$
0
0

Hi,

I want to format the date time format of bindings in multiple forms {Binding StringFormat={} ...}.

Because I have many bindings, I want to know if there is a way how to configure this application wide as you can do it with styles, etc.

Thank you!

WPF DatePicker.Displaydate problem when changing from Month to Year.

$
0
0

I am working on a VS 2010, .NET 4.0 WPF - MVVM application. I encountered a problem with the date shown by the calendar with the scenarios below.

Here are the steps to repro: This is not the actual code or pattern I am doing but it is enough to show the problem.

1.) Create a new WPF project.

2.) In the designer put a DatePicker and Button.

3.) Add a buttonClick event handler to the button. In the event handler set datePicker.DisplayDate = DateTime.Today.

Run the project.

1.) Now in the UI open the calendar from the datepicker and select a date from any other month but preferably a year from now. ex: March 1, 2014.

2.) After selecting a date, click the button to set the DisplayDate to today.

3.) Open again the calendar from the datepicker. At this point you will see that the calendar will correctly show February 2013.

4.) Now the problem is this: While the calendar is open click on the header (February 2013) to change the view from month to Year. When you click the header it incorrectly shows 2014 and, using my example, March is highlighted. Since the calendar started showing February 2013 shouldn't it show 2013 as well when the header was clicked?

WPF

$
0
0
como aplicar o padrão arquitectónico MVC com o desenvolvimento de aplicações para windows com a WPF?

Detect changes for an already existing property

$
0
0

I am extending a textblock element, and in the specific I have to detect changes of its ForegroundProperty.

How can I do this ?

for a custom property I write something like this:

public static readonly DependencyProperty MyProperty =
            DependencyProperty.RegisterAttached("Property",
            typeof(bool), typeof(MyClass), new PropertyMetadata(false, PropertyChanged));

What if a property already exists?

Thank you 


Another ListBox DisplayMemberPath question...

$
0
0

Hello Guys!

  Imagine i got a listbox binded with a ListCollectionView of item's, let's say Person's and i have set the DysplayMemberPath of the ListBox to, "Name".

  Is there a way i can get the list of all "names" displayed on the Listbox without any collection or item interaction?

  

WPF app with resize property will crash in Windows 8 OS (0x88980406 )

$
0
0

Dear All

Can you help to analysis this issue?

WPF app with resize property will crash in Windows 8 OS (0x88980406 )

<<Reproduce Step >>

  1. Create a Dialog based WPF application with VS2010.
  2. Mainwindow.xaml <Window> section ResizeMode property with the value of “CanResizeWithGrip or CanResize or CanMinimize”. Set as “NoResize” value will be OK.
  3. Mouse move focus to some control, such as check box/list box etc.
  4. Press Win+D to minimize the dialog UI.
  5. Press Win+D again to restore the dialog UI to desktop. Then the abnormal will be occurred.

<<Coding>>

<Window x:Class="WPF_ResizeMode_Abnormal.MainWindow" ResizeMode="CanResizeWithGrip" ></Window>

<<Notes>>

  1. This issue cannot be reproduced on Windows7 OS.
  2. This issue cannot be reproduced, if ResizeMode property with value NoResize.
  3. This issue can be reproduced with or without ZDP and latest patch files.
  4. This issue can be reproduced on most of TOSHBIA PCs, NOT all the PCs. If one PC can be reproduced once, it can be reproduced every time.
  5. There are many discussion for the HRESULT error code 0x88980406 without solution.
    1. http://connect.microsoft.com/VisualStudio/feedback/details/500410/wpf-crashes-with-error-hresult-0x88980406
    2. http://connect.microsoft.com/VisualStudio/feedback/details/674249/wpf-renderer-thread-exited-with-codes-0x88980406-0x88980403


Guo


Use Variable in XAML Binding Expression?

$
0
0

Hi, I have a question about binding a WPF control to a variable source.  Presently, my controls are bound to an XML document which looks like this:

<data_type Id="conveyor_plc_data"><plc_type Id="Main"><plc Id="FeedCarousel" Active="" DataLen="100"><Item Id="Cmd" Active="True" DataLen="2" Type="Short" Value="0"/><Item Id="Data" Active="True" DataLen="2" Type="Short" Value="0"/><Item Id="ConvOffset1" Active="" DataLen="2" Type="Short" Value="0"/><Item Id="ConvOffset2" Active="" DataLen="2" Type="Short" Value="0"/><Item Id="CaroAngle" Active="True" DataLen="2" Type="Angle" Value="90"/></plc_type><plc_type Id="Backup"><plc Id="FeedCarousel" Active="" DataLen="100"><Item Id="Cmd" Active="True" DataLen="2" Type="Short" Value="0"/><Item Id="Data" Active="True" DataLen="2" Type="Short" Value="0"/><Item Id="ConvOffset1" Active="" DataLen="2" Type="Short" Value="0"/><Item Id="ConvOffset2" Active="" DataLen="2" Type="Short" Value="0"/><Item Id="CaroAngle" Active="True" DataLen="2" Type="Angle" Value="90"/></plc_type></data_type>

Here is the XAML definition for a particular control:

<RonM:CustomScrollBar Width="100" Height="100" HorizontalAlignment="Left" Margin="20,135,0,0" x:Name="EntryCarousel" VerticalAlignment="Top"><RonM:CustomScrollBar.Value><Binding  Mode="OneWay" XPath="data_type[@Id='conveyor_plc_data']/plc_type[@Id='Main']/plc[@Id='FeedCarousel']/Item[@Id='CaroAngle']/@Value"/></RonM:CustomScrollBar.Value></RonM:CustomScrollBar>

Now the requirement is that sometimes the "Main" section of the XML document controls the action, and sometimes the "Backup" section controls it.  Between each of those sections, the structure of the contents are identical except for perhaps the Value attribute.

So is there any way to make the "[@Id='Main']" part be variable, so it would equate to "[@Id='Backup']"?

I tried defining a String variable in the XAML and using a {StaticResource} tag within the XPath string, but that wouldn't work.

I would appreciate any ideas on how to solve this.

Thanks...


Ron Mittelman

How to show lots of data at the same time in WPF

$
0
0

Hi all,

We are converting an MDI based application to WPF. I have read many posts on the subject.  The most common are to use 1 of the codeplex solutions or find a 3rd party library.  Ok, that's fine if I want to stay with MDI.

The next most commong response is to use a tabbed page.  This is great until you have lots of data.

Imagine a typeical user of a big system with many tables. They often have to have multiple records from the same table open at a time, especially when dealing with data for other tables. In an MDI world, they just have all the forms open and can jump to them as needed (sort of like what we do in windows.)  A tabbed page approach might allow them to have all the forms open, but only 1 would ever be visible....

Think of a stock advisor on the phone with a client, having details of each stock they discuss open in individual windows, a customer page so they can take notes, and various forms up used to search for a variety of investments (with each type of investments having a different lookup and result approach.) 

What is the standard solution for complex situations like this in WPF?

Thanks


me (and yes, I DO mark correct answers)

How to Data Bind XML Data to a user control Dependency Property

$
0
0

I am new to WPF and am trying to understand how to use XML data to bind to properties of a custom control.   My long term plan is to use external XML data to drive building UI elements.  I have created a user control that is made up of a ToggleButton that has a slider, textbox and label control within it.  I want to be able to add multiple copies of this user control in my main UI and then populate the properties of its controls (Button Content, Slider Min/Max/Value, Label Content) using the XML data.

I think I have everything setup correctly but when I test my application I am not seeing my XML data populate my user control properties.  I don't get any errors it just doesn't seem to be working.   I think the problem is how my Dependency Properties of my user control are setup.

I setup my XML data like this

<Application.Resources><XmlDataProvider x:Key="MyDataSource" Source="MyData.xml" d:IsDataSource="True"/></Application.Resources>

The layout of my user control looks like this

<ToggleButton x:Name="toggleButton" Content="Test Button" VerticalContentAlignment="Top" HorizontalContentAlignment="Left" Grid.RowSpan="4" Grid.ColumnSpan="4"><ToggleButton.ContextMenu><ContextMenu><MenuItem Header="Enable" IsCheckable="True" IsChecked="True"/><MenuItem Header="Solo" IsCheckable="True"/></ContextMenu></ToggleButton.ContextMenu></ToggleButton><Slider x:Name="sliderControl" HorizontalAlignment="Center" Height="25"  VerticalAlignment="Top" Width="140" Maximum="100" LargeChange="5" SmallChange="1" TickFrequency="5" TickPlacement="BottomRight" Value="50" Grid.Row="2"  Grid.ColumnSpan="4" Margin="7.5,0" Minimum="0"/><TextBox x:Name="textbox" Text="{Binding ElementName=sliderControl, Path=Value}" Grid.Row="3" Grid.Column="1" Margin="0,0,0,5"  /><Label x:Name="labelControl"  Content="dB" Grid.Row="3" Grid.Column="2"/>


Here is an example of the Dependency property declaration for the user control

	Public Shared ReadOnly ButttonTextProperty as DependencyProperty = DependencyProperty.Register("ButtonText",GetType(String),GetType(ButtonSlider)) 
	Public Property ButtonText() as String
		Get	
			Return GetValue(ButttonTextProperty)
		End Get
		Set(ByVal value as String)
			SetValue(ButttonTextProperty, value)
			toggleButton.Content = value
		End Set
	End Property


Lastly here is how I am referencing the user control in the main application and binding the XML data to it.

<local:ButtonSlider ButtonText="{Binding XPath=MyXMLDATA/ControlRecord/@Name}" LabelText="{Binding XPath=MyXMLDATA/ControlRecord/@Metric}" SliderMax="{Binding XPath=MyXMLDATA/ControlRecord/@Max}" SliderMin="{Binding XPath=MyXMLDATA/ControlRecord/@Min}" SliderValue="{Binding XPath=MyXMLDATA/ControlRecord/@Value}" Height="80" Width="155"/>

Here is a sample of the XML data

<MyXMLDATA><ControlRecord ID="1" Name="Control 1" Enable="True" Solo="False" Min="-12.0" Max="12.0" Metric="dB"/><ControlRecord ID="2" Name="Control 2" Enable="True" Solo="False" Min="0" Max="100" Metric="%"/></MyXMLDATA>

What I would expect to see on my single control I have laid out for the Button Content is "Control 1"  but it is still displaying the "Test Button" default from the user control?

What am I missing or what am I doing wrong?

 

 


Jeff Davis

Viewing all 18858 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>