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

Problem fetching field data from rdlc report

$
0
0

I am trying to automate an application. Using UI Spy I found that the Control Type for acell in rdlc report is ControlType.Text. I have been trying to retrieve the value in the cell but have been unable to do so. Can anyone tell me how toretrieve data from a rdlc report and some information on ControlType.Text.

How can I get the Values from the report?



Dynamically generated view loading in wpf prism unity..

$
0
0

Hi Folks,

Was wondering what is the best way of loading a dynamically generated view with content, in wpf prism application using prism application. Example i have a xaml file with some content inside it(example a news story), and now that xaml file needs to be replaced with a different file, during runtime. 

Regards

Suresh

Get the current UserControl in a project in WPF

$
0
0
I have lots of UserControl in a project build on MainWindow , they will be show different view in screen, I can switch those UserControl but I want get information of current UserControl.How can I get the current UserControl ?

Wpf Textbox.AppendText is not showing in rum time

$
0
0

Dear Experts,

I'm using below code some process and i wish to show steps as finished task. the textbox is showing content run time but after finished the loop content is showing

What is missing

    Private Sub btnclose_Click(sender As Object, e As RoutedEventArgs) Handles btnclose.Click
        Dim x As Integer = 0
        For x = 0 To 18
            tbProgress.AppendText("Process Steps " + x.ToString + Environment.NewLine)
            System.Threading.Thread.Sleep(50)
        Next
    End Sub


Thanks & Regards Manoj Patel

wpf listbox should not resize with content

$
0
0

Hi

desktop application using wpf:

i have one list box which is in grid, and my list box is re-size when window re-size. but at a same time it also re-size when list-box content is longer.

i want my list box to re size with window re size not with longer content, in case of longer/more content i want my list box to have scrolling.

ContextMenu is not shown for the empty space of DockPanel in DataGridTemplateColumn.

$
0
0

Hi,

I have created DataGridTemplateColumn dynamically with a dock panel containing TextBlock left aligned and Image right aligned.

Now I need to show ContextMenu in cell right click. I did that. But contextMenu is displayed only if I click on either text or Image. If I Click on the empty middle space its not getting displayed. Below is the code I wrote to set ContextMenu for Dock Panel.

My code:

l_column.CellTemplate.VisualTree.SetValue(ContextMenu.ContextMenuProperty, l_ContextMenu);

Can someone suggest me what can be done to solve this issue.

Thanks in advance.

 

Regards,

Mohana.

horizontal scroll not working in wpf usercontrol please help new to wpf

$
0
0
 <Grid Name="SP_ViewsMappingsDataGrid" Height="200" Width="600" VerticalAlignment="Top"  Margin="20,230,44,0"  HorizontalAlignment="Left" >
            <DataGrid AutoGenerateColumns="True" Margin="0,5,0,0" IsReadOnly="True" Height="Auto" Name="DGV_ViewMappings" Width="Auto" CanUserDeleteRows="False" CanUserAddRows="False" SelectionMode="Single" SelectionUnit="Cell" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" Visibility="Hidden">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="Action" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Click="Button_Click">Edit</Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        <!--</StackPanel>-->
        </Grid>

WPF element is OffScreen Error

$
0
0

I am currently working on UI automation using White Framework..I have a ListView consisting of multipple rows.

Now when i try to select the rows using their index I am able to select the one at index 0 but not the other rows.

Each row actually contains a button that I need to click. So when the execution comes to button.Click() for some row other than the one at index 0 it throws an exception as WPF element offscreen. How do i resolve this error..

Here is the code for that  I am using..

var datagrid = BonusAppControllers.EbsControl.GetCurrentWindow().GetModalWindowByAutomationId(_modalWindowName).GetByAutomationId<ListView>("lvUnassignedList");
            datagrid.Select(index);
            AutomationElement element = datagrid.Rows[index].AutomationElement.FindFirst(TreeScope.Descendants, SearchConditionFactory.CreateForAutomationId("btnListAdd").AutomationCondition);
            Console.WriteLine(datagrid.Rows[index].IsSelected);
            Button btn = new Button(element, datagrid.ActionListener);
            btn.Click();


DataGrid column style -> can't get what I want...

$
0
0

Hi,

Somehow I can't figure out how to set the DataGrid so it shows columns which are not readonly in other background color.

What I currently get:

What happens if I select a editable cell:

What I would like to have is that the "editable cells are completely colored yellow (not only the text) and that the content of the cells stays visible when selecting a cell.

this is my XAML:

<UserControl.Resources><Style TargetType="{x:Type DataGridCell}"><Setter Property="HorizontalAlignment" Value="Right" /><Style.Triggers><Trigger Property="IsReadOnly" Value="False"><Setter Property="Background" Value="Yellow" /></Trigger></Style.Triggers></Style></UserControl.Resources><DataGrid ItemsSource="{Binding Steps, Mode=TwoWay}" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility="Column" SelectionMode="Single" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" HorizontalAlignment="Left" Margin="0,0,2,0" ><DataGrid.ContextMenu><ContextMenu><MenuItem Header="Neu Zeile" Command="{Binding AddNewStepCommand}"/><MenuItem Header="Zeile löschen"/></ContextMenu></DataGrid.ContextMenu><DataGrid.VerticalGridLinesBrush><SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveBorderColorKey}}"/></DataGrid.VerticalGridLinesBrush><DataGrid.HorizontalGridLinesBrush><SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveBorderColorKey}}"/></DataGrid.HorizontalGridLinesBrush><DataGrid.Columns><DataGridTextColumn Binding="{Binding LoadStep}" ClipboardContentBinding="{x:Null}" Header="Lastenstufe i" IsReadOnly="True"/><DataGridTextColumn Binding="{Binding Amplitude}" ClipboardContentBinding="{x:Null}" Header="Hub [mm]" IsReadOnly="True"/><DataGridTextColumn Binding="{Binding RelativAmplitude, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ClipboardContentBinding="{x:Null}" Header="X/Xmax [%]"/><DataGridTextColumn Binding="{Binding SpectrumSum}" ClipboardContentBinding="{x:Null}" Header="Kollektiv" IsReadOnly="True"/><DataGridTextColumn Binding="{Binding RequiredLoadCycles}" ClipboardContentBinding="{x:Null}" Header="Häufigkeit"/><DataGridTextColumn Binding="{Binding Order}" ClipboardContentBinding="{x:Null}" Header="Reihenfolge"/></DataGrid.Columns></DataGrid>

Thanks for any hints or help!

Regards
Rainer

Beginner WPF Class Question - Using private variable versus corresponding public property?

$
0
0

I'm new to the .Net world and am diving into the fun and challenging aspects of MVVM, classes, and binding with WPF.

I've managed to get my first application up and running quite nicely so far, which is a basic Time Clock.  The idea is that I'm trying to use a single button, tied to an Icommand, which handles "Clock In", "Clock Out", and "Commit Record".  I have everything all bound and did manage to get this to work, but I'm hoping someone can help clarify as to why the binding only works when I set the public property through the method, whereas it does not work when i set the associated private variable.

So, hopefully this will provide a more clear view of what I'm talking about:

In the ViewModel of the View in question, I have these snippets:

Private _NewClockInTime As Nullable(Of Date)
        Public Property NewClockInTime As Nullable(Of Date)
            Get
                Return _NewClockInTime
            End Get
            Set(value As Nullable(Of Date))
                _NewClockInTime = value
                NotifyPropertyChanged("NewClockInTime")
            End Set
        End Property


        Public Sub ExecAddTimeRecord(ByVal param As Object)

            'Check the current state
            Select Case Me.AddTimeRecordState

                Case "Clock In"

                    'Set New Clock In Time
                    _NewClockInTime = Date.Now

                    'Change State
                    _AddTimeRecordState = "Clock Out"

                Case "Clock Out"

                    'Set New Clock Out Time
                    Me.NewClockOutTime = Date.Now

                    'Change State
                    Me.AddTimeRecordState = "Commit Record"

                Case "Commit Record"

                    Call MsgBox("Send to DB")

                    'Clear Values

                    'Change state to start "Clock In"
                    Me.AddTimeRecordState = "Clock In"

            End Select

        End Sub
<TextBox Text="{Binding NewClockInTime, Mode=TwoWay}" Height="30"/><TextBox Text="{Binding NewClockOutTime, Mode=TwoWay}" Height="30"/>
<Button Content="{Binding AddTimeRecordState, Mode=TwoWay}" Height="30" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                    Command="{Binding AddTimeRecord, Mode=TwoWay}"/>

So, in the above code, I've actually shown my two different implementations.  For Case "Clock In", I'm using the private variable tied to "NewClockInTime", for the other two, I'm using the public property.  If I run the application like this, the TextBox bound to NewClockInTime never updates, this is despite the fact that I know the public property NewClockInTime is, in fact, changing through the use of the Immediate Window while stepping through the code.  Also, the Content attribute for the Button never reads "Clock Out".  If I switch the implementation to use the public property for all three "states", everything works as I expect.

Can anyone explain to me why, when all of these elements exist within the same ViewModel, it doesn't work when I try to set the private variables rather than the public properties?  I expected that implementing INotifyPropertyChanged for these Public properties would cause the binding to work when I used the private variable within a method in the same class.

Thanks in advance for explaining this to a confused newbie! :)

.Net MVVM accessing property of "parent" ViewModel

$
0
0

Hello!

I'm building my first vb.net/wpf/mvvm application and have run into a small snag that I can't seem to find an answer for on the internet.  My application launches viewMainWindow with viewModelMainWindow as the DataContext.  Here is my viewModelMainWindow constructor:

        Public Sub New()

            'Declare Variables
            Dim wsTimeClock As New Workspace
            Dim vwTimeClock As New viewTimeClock
            Dim collWorkspaces As New ObservableCollection(Of Workspace)
            Dim objCurrentUser As New CurrentUser
            Dim objSQLServer As New SQLServer

            'Check for User Permissions to SQL Server
            If objSQLServer.HasSQLServerLogin(objCurrentUser) = False Then

                'Create the Login
                objSQLServer.CreateSQLServerLogin(objCurrentUser)

            End If

            'Check for database role
            If objSQLServer.HasDatabaseRole(objCurrentUser, "DB_StandardUser") = False Then

                'Grant DB_StandardUser Role
                objSQLServer.AddStandardUserRole(objCurrentUser)

            End If

            'Check for Employee Record
            If objCurrentUser.HasEmployeeRecord() = False Then

                'Create an Employee Record
                objCurrentUser.CreateEmployeeRecord()

            End If

            'Set the Public CurrentUser property to objCurrentUser
            Me.CurrentUser = objCurrentUser
            Call MsgBox(Me.CurrentUser.EmployeeID)

            'Set Values for wsTimeClock
            wsTimeClock.ViewModelName = "vmTimeClock"
            wsTimeClock.tabName = "Time Clock"
            wsTimeClock.ViewObject = vwTimeClock

            'Add workspace to collection
            collWorkspaces.Add(wsTimeClock)

            'Set Public Property Workspaces to collWorkspaces
            Me.Workspaces = collWorkspaces

            'Clean Up
            objCurrentUser = Nothing
            objSQLServer = Nothing

        End Sub

The msgbox is to show that, in fact, this code is working as I expect and the correct EmployeeID (2 in this case) is returned (HasEmployeeRecord() and CreateEmployeeRecord() both set EmployeeID in my CurrentUser class).  The problem I'm having is that I need my "child" ViewModels to be able to access the CurrentUser public property of viewModelMainWindow:

        Public Property CurrentUser As CurrentUser
            Get
                Return _CurrentUser
            End Get
            Set(value As CurrentUser)
                _CurrentUser = value
            End Set
        End Property

Here is a snippet from a child ViewModel called ViewModelTimeClock:

                    Dim timeRecord As New TimeRecord
                    Dim objCurrentUser As New CurrentUser

                    'Set values
                    timeRecord.EmployeeID = objCurrentUser.EmployeeID
                    timeRecord.ClockInTime = _NewClockInTime
                    timeRecord.ClockOutTime = _NewClockOutTime
                    timeRecord.Notes = _NewNotes

                    'Commit record to database
                    timeRecord.CommitTimeRecordToDB(objCurrentUser)


This actually doesn't generate any error message and adds the record to the DB, but the problem is that since I never call HasEmployeeRecord() or CreateEmployeeRecord(), EmployeeID is never set properly.  Obviously, I could call one to get it set, but I would prefer to only have to retrieve EmployeeID once and then access it from all child ViewModels rather than instantiating a CurrentUser object over and over again.  From my research, I know that I could probably get this done by adding a "CurrentUser" parameter to each child ViewModel constructor, but I can't figure out how to pass parameters with my current implementation of assigning the ViewModel in my XAML for ViewTimeClock:

<UserControl.DataContext><VM:viewModelTimeClock/></UserControl.DataContext>

Any tips about how to handle this would be greatly appreciated!!

Thanks in advance,

Kris

Jumpy Slider control behavior

$
0
0

Hello all. I have a Slider control that is using two way data binding to its Value property that's showing some strange behavior. I have the following properties set for the control:

IsSnapToTickEnabled="True" Value="{Binding SourceValue, Mode=TwoWay}" Maximum="360" Minimum="0" SmallChange="10" TickFrequency="10" LargeChange="20"

Every time the "Value" property changes I perform some moderately time-consuming processing. When I alter the Slider control by clicking on the thumb and holding down the arrow key on the keyboard everything happens smoothly and in real-time. However, if I drag the thumb with the mouse the thumb becomes erratic and appears to frequently bounce/jerk backwards before resuming motion in the direction of the mouse dragging. This results in jittery "Value" changes which result - of course - in jittery processing results that I display to the user. What is causing this poor behavior and how can I correct it? Thank you all in advance.

-L



how to build a player to run different WPF application

$
0
0

Dear all,

I have a project to build an WPF application which will read its configuration setting and parameter from a database hosetd in the cloud. When the local application start, It will read it configuration and setting directly from cloud DB before showing a sing user action. The drawback in that is that I need a mimimum setting for the application in order to be able to connect.

Then I though about an other approach which is to build a kind of WPFAppPlayer which is a small layer running locally. When that player start, the user will have to select the type of application to run ( ApplicationA or Application B or C), then application binaries gets injected in the player which then show the User interface.

This approach could then work with any type of application that I can configure online and beeing started by the Player.

Any idea howto build that player or which techniques to use ?

regards

wpf - mismatch between the processor architecture

$
0
0

Last post of the night...

I'm getting an error about a mismatch in architecture. I'm kind of new to VS, but can code a little. My knowledge into these deeper issues is about non-existent thought. I read Microsoft debugging tut, but can't get it working after following steps. My application runs but I can't see designer window because of cast error. It says something about a control I don't think I used. I did add something to my window, but took it off. Strange the app runs, and works, but no designer view...

I added a new window and some controls to my toolbox. Added some controls to the new window (ink canvas and a few other things...Then got the error...deleted the new window, and removed the extra tools from the toolbox, but still no good...

This is the error when I run the program.Warning    1    

There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "microsoft.expression.utility, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86","x86".

and this is the exception in my designer view.

[A]Microsoft.Expression.Utility.Controls.ClearableSearchTextBox cannot be cast to [B]Microsoft.Expression.Utility.Controls.ClearableSearchTextBox. Type A originates from 'Microsoft.Expression.Utility, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'LoadFrom' at location 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\microsoft.expression.utility.dll'. Type B originates from 'Microsoft.Expression.Utility, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.Expression.Utility.dll'.
   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.SceneNodePropertyInspectorPane.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetConnectionId(Object root, Int32 connectionId, Object instance)

System.Windows.Markup.XamlParseException
Set connectionId threw an exception.
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.SceneNodePropertyInspectorPane.InitializeComponent()
   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.SceneNodePropertyInspectorPane..ctor(IDesignerContext designerContext, PropertyInspectorPaneContext paneContext)
   at Microsoft.Expression.XamlPlatform.XamlPlatform.<>c__DisplayClass7.<Initialize>b__0()
   at Microsoft.Expression.DesignSurface.UserInterface.WindowContext.CreatePane(Border container, Func`1 callback, String identifier)
   at Microsoft.Expression.DesignSurface.UserInterface.WindowContext.GetPaneContainer(String identifier)
   at Microsoft.Expression.DesignSurface.UserInterface.WindowContext.GetPane(String identifier)
   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyPaneModelExtension.GeneralPropertyPaneModel(IDesignerContext designerContext)
   at Microsoft.Expression.XamlPlatform.XamlPlatform.Initialize(IDesignerContext designerContext)
   at Microsoft.Expression.DesignSurface.DesignerDefaultPlatformService.Initialize()
   at Microsoft.Expression.DesignSurface.DesignerDefaultPlatformService.get_DefaultPlatform()
   at Microsoft.Expression.DesignSurface.DesignerDefaultPlatformService.Initialize()
   at Microsoft.Expression.DesignSurface.DesignerContext.InitializeDesignerViewComponents()
   at Microsoft.Expression.DesignSurface.DesignerContext.Initialize(DesignerServiceInitializationLevel level)
   at Microsoft.Expression.DesignSurface.DesignerService.InitializeDesignerViewComponents()
   at Microsoft.Expression.DesignSurface.DesignerService.Initialize(DesignerServiceInitializationLevel level, IHostProject project, CancellationToken cancelToken)
   at Microsoft.Expression.DesignSurface.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass13.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner>b__12(CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.<>c__DisplayClass3`1.<MarshalInWithCancellation>b__2()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.Windows.Markup.XamlParseException
Set connectionId threw an exception.

Server stack trace:
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalInSynchronous(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.MarshalInWithCancellation[TResult](IRemoteCancellationToken remoteToken, Func`2 func, ApartmentState apartmentState)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteDesignerService.Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken remoteToken)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteDesignerService.CreateDesigner(IRemoteHostProject remoteProject, IRemoteHostSourceItem remoteItem, IRemoteHostTextEditor remoteEditor, IRemoteCancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.CreateDesignerImpl(IRemoteDesignerService ds, IHostSourceItem item, IHostTextEditor editor, RemoteCancellationToken remoteCancelToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass19.<Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner>b__18(IRemoteDesignerService ds, RemoteCancellationToken remoteToken)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.<>c__DisplayClass5`1.<MarshalOutWithCancellation>b__4(IRemoteDesignerService ds)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass1`1.<MarshalOut>b__0()
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.Windows.Markup.XamlParseException
Set connectionId threw an exception.
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action`1 action, CancellationToken cancelToken, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.MarshalOutWithCancellation[TResult](CancellationToken cancelToken, Func`3 func, ApartmentState apartmentState)
   at Microsoft.Expression.DesignHost.Isolation.Remoting.LocalDesignerService.Microsoft.Expression.DesignHost.IDesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)

Windows Explorer context menu in my program

$
0
0

How do I get Windows Explorer's default file context menu (the one I get with R-Click on file) open in my program?

I have a listbox listing files in a folder, is there an easy way to get that menu when user clicks on a listboxitem?


How to disable user input for WPF date picker ?

$
0
0

Hi Experts,

Is there any way to disable the users from manually typing in date into date picker field ? But shuould be able to pick a date by clicking the picker button.

Appreciate your help


Vacation Calendar / Scheduler in VB.net WPF?

$
0
0
Hi All,
 
I've got a question regarding Calendar or Scheduler. Maybe first I will describe you, what I would like to achieve. My application is some kind of employee management tool, and my idea is to create vacation planner as well. I'm using user controls to open things in mainWindow (as a child.add). What I have regarding vacations/holidays is User control with two dateTimePickers - StartDate and EndDate, next is Employee ID (filled automatically by loading data from SQL table) and VacationType combobox. Employee view is okay, they can log vac/hol in table, but I would like to see their logs on administrator form, and I would like to make this kind of view for them (to show their team members logs). So, the question is - in your opinion, I should use DataGrid/listView to create "gantt" chart to create something like that :
http://code.daypilot.org/image/big/vzwi2c5j55gavjxndxlvzk3iaq[^]
 
Or should I use WPF controls, because it's not possible to create this kind of "graph" using standard controls? 
 
Thank you in advance!

Mathh

MVVM DataTemplate and ContentPresenter

$
0
0

In my example i have a MainView and in that i want to show a UserControl (ParentView). I'm trying to use MVVM so i also have a MainVM and a ParentVM.

In a resource file i have following code: 

        <DataTemplate x:Key="PVM" DataType="{x:Type local:ParentVM}">
            <local:ParentView />
        </DataTemplate>

The MainVM creates and instance of ParentVM. Instead of adding my ParentView to my MainView in XAML I want to use a ContentPresenter on my MainView. I just can get my ParentView to show up in my MainView when using the ContentPresenter. Can someone help me with this?

Thanks

AHR

 

iterate a collection of images in a resource that is deployable

$
0
0
Uri graphicURI = new Uri("pack://application:,,,Resource.resx", UriKind.Absolute);
StreamResourceInfo ri = Application.GetResourceStream(graphicURI);
ResXResourceReader rsxr = new ResXResourceReader(ri.Stream);
IDictionaryEnumerator id = rsxr.GetEnumerator();
FileInfo[] filesInDir = rsxr.DirectoryToSearch.GetFiles();

In WPF .Net 4, how do find the and iterate the collection of Images from a resource?  I need to be able to find a particular image from the collection of images.  I have the the build selection as a resouce and copy all selected for the images.  I have 4 images of interest in this location path and can see them in the proejct Resources selection under Images.

C:\Projects\PMF Tracking System\PMF Scan-To-Print\PMF Scan-To-Print\Images\???.jpg

I need to be able to deploy the application and earlier I was a known directory path with them in it but I won't be able to do that way because of deployment issues.  Thanks for any help...



Trouble With Dictionary

$
0
0

Hey,

I'm having trouble loading a dictionary .lex file. I'm not sure what the problems is. I've got a resource file called dictionary.resx with waterdictionary.lex added to. The lex file is in my Resources folder. The build action on both files is resource.

My Wpf code is

<SpellCheck.IsEnabled>true</SpellCheck.IsEnabled><SpellCheck.CustomDictionaries><sys:Uri>Pack://application,,,/Water SV1;component/Resources/waterdictionary.lex</sys:Uri> </SpellCheck.CustomDictionaries>

Viewing all 18858 articles
Browse latest View live


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